Author Topic: Searching data  (Read 2567 times)

GotPHP

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Searching data
« on: June 06, 2008, 02:01:17 PM »
I have a form with a few text fields and 2 image fields.  Now after the form is filled,  I want to the users to be able search based on the text fields
.
I am lost after I set up my forms. I know that this question maybe a very long to answer.  So I just need a tutorial or an example on how this is done so i can change it around and to fit my site.


So my main goal is:

1. To have a form
2. To have the users fill out the form
3. Store the data
4. Allow the users to search all the data.


I have the html and php files.

here is my html.

<body>
<form action="sample_form.php" method="post" enctype="multipart/form-data">

Text Field One:
<input type="text" name="one">
<br><br>
Text Field Two:
<input type="text" name="two">
<br><br>
Text Field Three:  
<input type="text" name="three">

<br><br>

Image Field One:  
<input type="file" name="file" id="file">
<br><br>
Image Field Two:  
<input type="file" name="image_two">
<br><br>
<input type="submit" />
</form>

</body>


here is my php.

<body>

<P> Text Field One:    <?php echo $_POST["one"]; ?><br /></P>
<P> Text Field Two:    <?php echo $_POST["two"]; ?><br /></P>
<P> Text Field Three:  <?php echo $_POST["three"]; ?><br /></P>
<P> Image Field One:   <?php echo $_POST["image_one"]; ?><br /></P>
<P> Image Field two:   <?php echo $_POST["image_two"]; ?><br /></P>


</body>

peg110

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 799
  • Karma: +0/-0
    • View Profile
    • http://www.tripleclicks.com/11260983/go
Re: Searching data
« Reply #1 on: June 09, 2008, 02:13:17 PM »
How are you going to store the data? I would suggest in a database as that makes things much easier.

Then you need only develop a query to "Search" the database and retrieve the requested/searched data.

Alternatively, you can use google itself to search your site. There used to be a way to do it for free, but I think they now have a "Pay for Searches" method now. (something like $100 / 50,000 queries / year)

GotPHP

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Searching data
« Reply #2 on: June 10, 2008, 08:01:00 PM »
I am not familiar in how to store it in a database or make a query.  Can you give me an example or lead me to a  tutorial?

boobay

  • Regular Member
  • **
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Re: Searching data
« Reply #3 on: June 11, 2008, 12:29:22 PM »
GotPHP,

http://http://www.tizag.com/mysqlTutorial/index.php is a decent tutorial which provides information about databases and examples. The examples show methods of querying the database to insert, update and delete information.

Hope this helps.

-boobay

GotPHP

  • New Member
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Searching data
« Reply #4 on: June 12, 2008, 08:34:50 PM »
Thanks thats a lot of help. I will work on it and come back later.