- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsI have this site:
http://www.fireplaceindust
it is a page with frames..
the upper frame is named up.php and here's the source:
it uses the data.php file to print search results.
I want to make it so that when there's a name entered in the Company box, the other fields should be ignored..
and if the other fields are chosen, than the name box should be ignored..
is it possible to do this with 2 submit buttons or do I need 2 separate forms for that?
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=windows-1254">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-9">
<title>FirePlaceIndustry.c
<base target="main">
</head>
<body leftmargin="0">
<div align="center"><center>
</center></div><div align="center"><center>
<table border="0" width="757" height="27" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="27" align="left"><form method="GET" target="main"
action="data.php">
<table border="0" width="587" height="1" cellspacing="0" cellpadding="0">
<tr>
<td width="83" height="15"><font face="Verdana" size="1"><strong>Company
</strong></font></td>
<td width="41"><font face="Verdana" size="1"></font></td>
<td width="42"><font face="Verdana" size="1"><strong>Product</
<td width="165" height="15"><font face="Verdana" size="1"><strong>Category
<?php
$dbcnx = @mysql_connect(
"localhost", "fireplac", "ongIboSAH");
mysql_select_db("fireplac"
$categories = mysql_query(
"SELECT ID, category from category order by ID ASC");
?>
<?php
$dbcnx = @mysql_connect(
"localhost", "fireplac", "ongIboSAH");
mysql_select_db("fireplac"
$counties = mysql_query(
"SELECT ID, county from county order by county ASC");
?>
<input name="page2" type="hidden" value=0>
</strong></font></td>
<td width="117" height="15"><font face="Verdana"
size="1"><strong>County</s
<td width="46" height="15"></td>
<td width="88" height="15"></td>
<td width="5" height="15"></td>
</tr>
<tr>
<td width="83" height="1" valign="middle"><input name="name" type="text"
id="name"
style="font-family: verdana; width: 145px; font-size: 10px" size="17"></td>
<td width="41" height="1" valign="middle"><input name="Search2" type="submit"
id="Search23"
style="background-color: rgb(0,48,156); color: rgb(156,207,254); font-family:
Verdana; font-size: 10px; font-weight: bold; border: 1 solid" value="Search"></td>
<td width="42" height="1" valign="middle"><select name="product"
size="1" id="select12"
style="font-size: 10px; width: 145px; font-family: verdana; color: rgb(0,0,0);
border: 1 solid rgb(0,0,0)" width="10">
<option selected>Select A Product</option>
<option>--------</option>
<option value="electric">Electric Fires</option>
<option value="gas">Gas Fires</option>
<option value="fireplaces">Firepla
<option value="stoves">Stoves</opt
<option value="nochimney">No Chimney Products</option>
<option value="solid">SoliFuel</op
<option value="lpg">LPG Appliances</option>
<option value="chimney">Chimney Products</option>
<option value="cast">Cast Products</option>
<option value="marble">Natural Marble</option>
<option value="stone">Stone Products</option>
<option value="accessories">Access
</select></td>
<td width="165" height="1" valign="middle"><select name="CATID"
size="1" id="CATID"
style="font-size: 10px; width: 145px; font-family: verdana; color: rgb(0,0,0);
border: 1 solid rgb(0,0,0)" width="10">
<OPTION SELECTED VALUE="">Select a Category
<OPTION VALUE="">---------
<?php
while ($category = mysql_fetch_array($categor
$CATID = $category["ID"];
$categoryname = $category["category"];
echo("<OPTION VALUE=$CATID>$categoryname
}
?>
</select></td>
<td width="117" height="1" valign="middle"><select name="COTID"
size="1" id="COTID"
style="font-size: 10px; width: 145px; font-family: verdana; color: rgb(0,0,0);
border: 1 solid rgb(0,0,0)" width="10">
<OPTION SELECTED VALUE="">Select a County
<OPTION VALUE="">---------
<?php
while ($county = mysql_fetch_array($countie
$COTID = $county["ID"];
$countyname = $county["county"];
echo("<OPTION VALUE=$COTID>$countyname\n
}
?>
</select></td>
<td width="46" height="1" align="center" valign="middle"><input name="Search"
type="submit" id="Search3"
style="background-color: rgb(0,48,156); color: rgb(156,207,254); font-family:
Verdana; font-size: 10px; font-weight: bold; border: 1 solid" value="Search"></td>
<td width="88" height="1"><div align="right">
<p align="center"><font size="1" face="Verdana, Arial, Helvetica,
sans-serif"><?php echo ( date("d.m.Y")); ?>
</font><font color="#FFFFFF"> </font></td>
<td width="5" height="1"></td>
</tr>
</table>
</form> </td>
</tr>
</table>
</center></div>
</body>
</html>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: GrinsPosted on 2005-11-20 at 07:00:56ID: 15329233
one way:
$name = (isset($_GET['name']) && $_GET['name'] !== "" ? $_GET['name'] : "");
$prod = (isset($_GET['prod']) && $_GET['prod'] !== "" ? $_GET['prod'] : "");
$cat = (isset($_GET['cat']) && $_GET['cat'] !== "" ? $_GET['cat'] : "");
$cnty = (isset($_GET['cnty']) && $_GET['cnty'] !== "" ? $_GET['cnty'] : "");
if (!empty($name) && empty($prod) && empty($cat) && empty($cnty)) {
//process based on name
} elseif (!empty($prod) && !empty($cat) && !empty($cnty) && empty($name)) {
//process based on other options
} else {
//user picked all the options, process accordingly
}
you'll want to add some more validation to this.
another option is to name the search buttons differently and base the query on the button the user clicked.