your form will pass it using the GET or POST method and would be available on 
the server in the $_GET array (or $_POST)

<form action="searchresult.php" method="POST">
   <label for="sterm">Search for</label>
   <input type="text" id="sterm" name="sterm" size="24">
   <input type="submit" value="Search Now">
</form>

searchresult.php can then access the value that was entered into the form by 
accessing the $_POST array

$SearchTerm = $_POST['sterm'];

if you are going to use it in a SQL query, I would do some validation on 
$SearchTerm as well


  ----- Original Message ----- 
  From: Derek Nugent 
  To: [email protected] 
  Sent: Monday, September 18, 2006 10:51 AM
  Subject: [php_mysql] simple search box


  How can I pass a form variable from a previous page to a query in a second 
page?

  I'm trying to set up a search box on my website.

  Excellent response time on the last php enquirey!

  AWESOME



  [Non-text portions of this message have been removed]



   

[Non-text portions of this message have been removed]



The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php_mysql/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to