Nov 8, 2009
Pages: 1, 2

How To Make A Search Form And Php Code? - Can you help please?

free web hosting

Read Latest Entries..: (Post #12) by iGuest on May 21 2009, 10:11 AM.
Display Data How To Make A Search Form And Php Code? Hi There, I found the above script very usefull. I want to go one step further though... I want to display a table with data based on the query. How do I do that?? Thanks in advance Gert
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion > MODERATED AREA > Computers > Programming Languages > Others

How To Make A Search Form And Php Code? - Can you help please?

wild20
I am looking to put a whole Bible on my site, don't worry about copyrights, I already have all that. It will be put into my site book by book. My problem? I need a form that will only search the /Bible part of my database. I need an html form, and then a php code that can be put into just ONE file but that will display a search page afterward. If you could help me out here, I would greatly appreciate it since I will need this in order for it to work. The goal is simple, have an html form, that will lead to a search of my entire inneed.mxweb.co.uk/bible database without searching anything else, but when you get the results, it will display it on another page that will be, say,...results.php. And then I would like to know if I have to save that results page as a php or html file, it will be displaying the results of the search. does anyone know if this is even possible or if it can be done? I know, complicated. Thanks.

Comment/Reply (w/o sign-up)

truefusion
Sorry that i'm not a database person, but seems like you are trying to do what bibleserver.com already has. What i'd suggest is link to that site, for now, until you get everything ready for your's. If you're lucky, you can somehow email bibleserver.com and if they're willing they can provide you with their coding. Though, i highly doubt it.

Comment/Reply (w/o sign-up)

wild20
I tried, but it didn't work. None of them want to provide you code. I will wait until there is someone who knows. I really need it though. I found one that was cgi-bin/something I don't know what it was though. I need to know what goes in the process code. I know you make a form, and set the value to get, but then there is the form action part. You know, the part like process.php that runs the whole works. That isn't working and I am not getting any happier sad.gif At least the Bible will be up though.

Comment/Reply (w/o sign-up)

arcticsnpr
aight, I made somthing to what I think your asking. If you go to the church site I made: CBF , it has a area where you can search for sermons in a database.
I'm thinking your using PHP 5.
aighy, here you go man... just wrote this up real quik for yu, very simple, hope it works for you smile.gif
, Arctic

html form:
CODE

<html>
    <head>
        <title>Search Test</title>
    </head>
    <body topmargin="0" leftmargin="0">
        <form action="search.php" method="post">
            Search Term <input type="text" name="searchterm"><br />
            <input type="submit" value="Search">
        </form>
    </body>
</html>


php search.php:

CODE

<?php
/*set varibles from form */
$searchterm = $_POST['searchterm'];
trim ($searchterm);
/*check if search term was entered*/
if (!$searchterm){
    echo 'Please enter a search term.';
}
/*add slashes to search term*/
if (!get_magic_quotes_gpc())
{
$searchterm = addslashes($searchterm);
}

/* connects to database */
@ $dbconn = new mysqli('host', 'username', 'password', 'database');
if (mysqli_connect_errno())
{
echo 'Error: Could not connect to database.  Please try again later.';
exit;
}
/*query the database*/
$query = "select * from tablename where tablerow like '%".$searchterm."%'";
$result = $dbconn->query($query);
/*number of rows found*/
$num_results = $result->num_rows;

echo '<p>Found: '.$num_results.'</p>';
/*loops through results*/
for ($i=0; $i <$num_results; $i++)
{
$num_found = $i + 1;
$row = $result->fetch_assoc();
echo "$num_found. ".($row['tablerow'])." <br />";
}
/*free database*/
$result->free();
$dbconn->close();
?>


oh, and your right, never alone with Christ, he reigns 4-ever

 

 

 


Comment/Reply (w/o sign-up)

wild20
Hmm, this look good, but I am using version 4.1 Will this display a results page? It all looks good, but I don't know how to edit it so I can use it on my site, if someone could take the time to show me a little more about this, I would really appreciate it. It would search my htt://ineed.mxweb.co.uk/bible database.

Also, it looks like this requires me to set up a MySQL database. Is this a code I can pout in a form and it will work as soon as I put it in? As you can see, I am quite lost in this coding. Thanks for the effort, just need a little more help with it. Thanks.

Comment/Reply (w/o sign-up)

arcticsnpr
ok, I should have clarified if you knew very much stuff about this. I'll tell you what... I can't do it now (big chem test) but i'll hook you up with a search thing in no time. few questions. are you using mysql? do you have the whole Bible in it? I'm going to need your table structure, the way you built it (rows columns ect..) and.. when dealing with this kind of stuff, you really should use PHP 5, if your running the server, install it, trust me. if your not running a server and you have no choice... I'll see what I can do. But for now please supply with your table structure in your database. If you don't know what this is, research it. I'll code it, no worries.
in Christ, arctic

Comment/Reply (w/o sign-up)

wild20
What is your email? I will send a zip folder with all the stuff in it. I can't use PHP 5. And I would prefer not to use a mysql. The place to search will be http://inneed.mxweb.co.uk/bible. That is what I will search. I will send you the blank zip folder, because the bible is not in it yet. Thank you SO much for your time, this will be a huge help. Do you have a site, I wil be linking to it if you do. this is great. And really appreciate the time you are spending on this. Thank you!

Comment/Reply (w/o sign-up)

True2Earn
QUOTE(wild20 @ Apr 21 2006, 02:17 PM) *

I can't use PHP 5. And I would prefer not to use a mysql.


I see your Bible is not up yet. Since you would rather not use mySQL and want it to be completely searchable then I would recommend going to The PHPBible Project website and take a look at Alex Markley's PHPScripture bible study tool. It seems to fit all your needs perfectly and it is GPL'ed. I hope this is helpful.

Comment/Reply (w/o sign-up)

wild20
Okay thanks. This looks great. I will use this. It look easy. Thanks. Yeah I want to put it on, and it looks like it will work great. I just needed something where people could search the Bible and stuff. It is the one addition to my site I REALLY wanted to make, because as my traffic increases, I want to be able to share the Bible, as well as other services too. And the Bible was that one part that was most important. Now I have it. Thanks again!

Comment/Reply (w/o sign-up)

FeedBacker
Tracey
How To Make A Search Form And Php Code?

Thanks for a beautiful site! I have added you in elected! http://cbnch.Icr38.Net


-reply by Tracey

Comment/Reply (w/o sign-up)

Latest Entries

iGuest
Display Data
How To Make A Search Form And Php Code?

Hi There,

I found the above script very usefull. I want to go one step further though...

I want to display a table with data based on the query. How do I do that??

Thanks in advance

Gert


Comment/Reply (w/o sign-up)

iGuest
can you please make it more clear ?
How To Make A Search Form And Php Code?

Replying to arcticsnpr
Hi artisncr..

I read your html code and php code.
I am looking for a site search also..In my php website

Could you please make 123 step for search.Php?
1. Where / which directory to upload this code.
2. Do I have to change database username etc ?

How can I see my database name ?

And could you please tell how to make a home page that have a dynamically change news from other side ?

Thank you artist

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2

Searching Video's for make, search, form, php, code
See Also,
advertisement


How To Make A Search Form And Php Code? - Can you help please?

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com