I keep trying to fix this but it's giving me the same errors:
Notice: Undefined index: items in C:\xampp\htdocs\shop.php on line 9
Notice: Undefined index: body in C:\xampp\htdocs\shop.php on line 24
Here is my code:
<form action="" method="post">
<input type="radio" name="items" value="fed" /> Fed<br />
<input type="radio" name="items" value="body" /> Body<Br>
<input type="submit" name="submit"><br>
</form>
<?php
if(isset($_POST['submit'])) {
$items = $_POST['items'];
if($items=="fed") {
echo "You choose feds";
die();
}
else
echo "<Form action='' method='POST'>
<select name='body'>
<option value='head'>Head</option>
</select>
<input type='submit' name='submit' value='submit' /><br />
</form>";
if(isset($_POST['submit'])) {
$body = $_POST['body'];
$connect = mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db("feds",$connect)or die(mysql_error());
$merchandise = mysql_query("SELECT * FROM merchandise WHERE body_part='$body' ")or die(mysql_error());
while($row = mysql_fetch_array($merchandise)) {
echo $row['item'];
echo "<bR>";
}
}
}
?>
Hey just use method as "POST" instead of "post" .hope so it would solve your problem just like mine.
Happy coding