Sign in to follow this  
wild20

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

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :blink: At least the Bible will be up though.

Share this post


Link to post
Share on other sites

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 :blink:
, Arctic

html form:

<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:

<?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

Share this post


Link to post
Share on other sites

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 http://forums.xisto.com/no_longer_exists/
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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://forums.xisto.com/no_longer_exists/. 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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Display DataHow 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

Share this post


Link to post
Share on other sites

Pls Help me......... This code work from our local machine... i can put server that canHow To Make A Search Form And Php Code?

this code source...

<?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('localhost', 'root', '', 'sample1');If (mysqli_connect_errno()){Echo 'Error: Could not connect to database.  Please try again later.';Exit;}/*query the database*/$query = "select * from sheet1 where IndexNo 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['IndexNo'])." <br />";Echo "<table border='1'><tr><th>IndexNo</th><th>Name</th><th>Marks</th><th>Rank</th></tr>";  echo "<tr>";  echo "<td>" . $row['IndexNo'] . "</td>";  echo "<td>" . $row['Name'] . "</td>";  echo "<td>" . $row['Marks'] . "</td>";  echo "<td>" . $row['Rank'] . "</td>";Echo "</tr>";}Echo "</table>";/*free database*/$result->free();$dbconn->close();?>-reply by Prashanth

Share this post


Link to post
Share on other sites
Real Estate WebsiteHow To Make A Search Form And Php Code?

I am making a real estate website and I have a search box. I want the buyers/sellers to be able to search for a home and however many bedrooms and bathrooms they want but I want the homes to pop up on my page. Does anybody have a code or a site to help me???? Any help is greatly appreciated. Thanks!!1

Share this post


Link to post
Share on other sites

Can you assist me with setting up the database that will be searched???? nicole.worthem@gmail.com


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


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this