search form w/ multiple fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a form with firstname, lastname, phone, and email fields. I would
like to search the database and return results to the same page in an
iframe. I want to be able to search my just one or multiple. For example
I can search by "firstname" with value of "john" and it will return all
"john" rows in iframe or search "firstname" value "john" and "lastname"
value "smith" and again will return all rows with data in iframe. 
 
I have tried this but don't think I am doing something correct:
$result = mysql_query ("select * from customerinfo where firstname like
'%".$_POST['firstname']."%' or '%".$_POST['lastname']."%' or
'%".$_POST['phone']."%' or '%".$_POST['email']."%'");
 
I cant seem to figure out how to display. I have tried <?php echo
$_POST['firstname']; ?> in the HTML but there was no return of data. 
 
This is my form:
 
<form action="search.php" method="post" name="search" id="search">
First Name: <input type="text" name="firstname" />
Last Name: <input type="text" name="lastname" />
Phone : <input type="text" name="phone" />
Email : <input type="text" name="email" />
<input type="submit" value="search">
</form>
 
all of this is on the same page, the page is called search.php 
 
 
 
 
 

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux