Moderators: macek, egami, gesf


Raisario wrote:What i'm trying to do is take an entry from a drop down box from a previous page to my WHERE clause in a SQL statement in a different page.
Dropdown box code from previous page:
<?php
if ($viewby=="description")
{
echo "<FORM NAME='SelectDescription' ACTION='PHPSearchResults2.php?Displayby=description' Method='Post'>
Select Category:<SELECT NAME='description'>
<OPTION SELECTED>The Home MarketPlace
<OPTION SELECTED>Walter Drakes
<OPTION SELECTED>Both
</SELECT>
<INPUT TYPE='submit' Name='cmdSearch' Value='Search'>
</FORM>";
}
?>
SQL statement in a different page:
$query_coupon = mysql_query ("SELECT coupontypes.coupon_id, coupontypes.percent_discount, coupontypes.description, coupons.status, coupons.purchase_amount, coupons.retailer_ordernum, coupons.purchase_time, users.username FROM coupontypes, coupons, users WHERE coupontypes.description = $description");
-------------------------------------------------------------------------------------
This code doesnt work. i need to know how to save entry from previous page without using session variables then use it in my sql statement
pls help a noob ASAP if possible, this project is almost due and teacher is gonna beat me down :cry:

Pejone wrote:I had delete your post.Raisario wrote:What i'm trying to do is take an entry from a drop down box from a previous page to my WHERE clause in a SQL statement in a different page.
Dropdown box code from previous page:
<?php
if ($viewby=="description")
{
echo "<FORM NAME='SelectDescription' ACTION='PHPSearchResults2.php?Displayby=description' Method='Post'>
Select Category:<SELECT NAME='description'>
<OPTION SELECTED>The Home MarketPlace
<OPTION SELECTED>Walter Drakes
<OPTION SELECTED>Both
</SELECT>
<INPUT TYPE='submit' Name='cmdSearch' Value='Search'>
</FORM>";
}
?>
SQL statement in a different page:
$query_coupon = mysql_query ("SELECT coupontypes.coupon_id, coupontypes.percent_discount, coupontypes.description, coupons.status, coupons.purchase_amount, coupons.retailer_ordernum, coupons.purchase_time, users.username FROM coupontypes, coupons, users WHERE coupontypes.description = $description");
-------------------------------------------------------------------------------------
This code doesnt work. i need to know how to save entry from previous page without using session variables then use it in my sql statement
pls help a noob ASAP if possible, this project is almost due and teacher is gonna beat me down :cry:
<?php
if ($viewby=="description")
{
echo "<FORM NAME='SelectDescription' ACTION='PHPSearchResults2.php?Displayby=description' Method='Post'>
Select Category:<SELECT NAME='description'>
<OPTION value=some1>The Home MarketPlace</option>
<OPTION value=some2>Walter Drakes</option>
<OPTION value=some3>Both</option>
</SELECT>
<INPUT TYPE='submit' Name='cmdSearch' Value='Search'>
</FORM>";
}
?>
$query_coupon = mysql_query ("SELECT `coupontypes.coupon_id`, `coupontypes.percent_discount`, `coupontypes.description`, `coupons.status`, `coupons.purchase_amount`, `coupons.retailer_ordernum`, `coupons.purchase_time`, `users.username` FROM `coupontypes`, `coupons`, `users` WHERE `coupontypes.description` = '$description'");

Return to PHP coding => General
Users browsing this forum: No registered users and 2 guests