PDA

View Full Version : php/sql, interface change refresh



randomagain
March 1st, 2007, 01:00 PM
Hi, newbie

I have got my code working, however I have to apply user interfaces.

Ie a Search and Dropdown

Question is how do I do this? :P

I need to input search and/or dropdown, then refresh the page, hence displaying the correct data.




$result = mysql_query('SELECT * FROM sweets WHERE sCategory = "Penny Chews" ');
?>
</head>
<body>
<?php
// print database content
while($row = mysql_fetch_array($result))
{


The following is all wrong but essenially the rig I want...


<form method="get" action="<?php print($_SERVER['PHP_SELF']); ?>">
Search:<input name="Make" id="Make" type="text" value="<?php print($uid); ?>" /><br/>
<select name=navi onChange="go()">
<option value=''>--- Select Catogory---
<option value="Penny Chews">Penny Chews
<option value="Bubblegum">Bubblegum
<option value="Boiled sweets">Boiled sweets
<option value="Tubes of sweets">Tubes of sweets
<option value="Fudge">Fudge
<option value="Chocolate Bars">Chocolate Bars
<option value="Lollies">Lollies
</select>
<input name="submit" type="submit" value="Update" />
</form>

mBm
March 4th, 2007, 01:50 PM
i can't understand your question well. please explain it clearly. but try following code to select selected category from query. i can't understand Make field for what too.



<?
$result = mysql_query('SELECT * FROM sweets WHERE sCategory = "'.rawurldecode($_GET['navi']).'" ');

?>



<form method="get" action="<?php print($_SERVER['PHP_SELF']); ?>">
Search:<input name="Make" id="Make" type="text" value="<?php print($uid); ?>" /><br/>
<select name=navi>
<option value=''>--- Select Catogory---
<option value="Penny Chews">Penny Chews
<option value="Bubblegum">Bubblegum
<option value="Boiled sweets">Boiled sweets
<option value="Tubes of sweets">Tubes of sweets
<option value="Fudge">Fudge
<option value="Chocolate Bars">Chocolate Bars
<option value="Lollies">Lollies
</select>
<input name="submit" type="submit" value="Update" />
</form>

randomagain
March 7th, 2007, 08:28 AM
thanks, that works

i agree my request doesn't make sense because I have the vaguest idea of what I am doing