tet3828 Posted November 4, 2006 Share Posted November 4, 2006 I am unable to retrieve the data that is sopposed to be posted by these forms.... any suggestions of why this is happening?function edit_what () {echo "Which value would you like to edit? <br />";echo "<form method='post' action='{$_SERVER['PHP_SELF']}'>";echo "<input type='hidden' name='id' value='{$_GET['id']}'>";echo "<input type='radio' name='edit' value='itemName'> Edit Name <br>";echo "<input type='radio' name='edit' value='itemDesc'> Edit Description<br />";echo "<input type='radio' name='edit' value='itemPrice'> Edit Price <br />";echo "<input type='radio' name='edit' value='itemAvil'> Edit Avialibilty<br />";echo "<input type=submit name=submit value=Submit /></form>";} Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 4, 2006 Share Posted November 4, 2006 Please post the script that you're using to retrieve the values.Ken Quote Link to comment Share on other sites More sharing options...
tet3828 Posted November 4, 2006 Author Share Posted November 4, 2006 function display_item () { $id = $_GET['id']; $qry = "SELECT itemName,itemCat,itemSub,itemId,itemAvil,itemPrice,itemDesc,itemSmall FROM `products` WHERE `itemId`=\"$id\""; $result = mysql_query($qry) or die(mysql_error()); echo "Listed below is the stored data for the item #$id <br /> Use the fields below the item table to modify the information."; while($row = mysql_fetch_array($result)) { echo "<table border=\"1\"><tr><td>".$row['itemName']."<td>Item ID# ".$row['itemId']."</td></td></tr>"; echo "<tr><td><img src=\"".$row['itemSmall']."\" /></td><td valign=top width=150>Description: ".$row['itemDesc']."</td>"; echo "</tr><tr><td>Price: $".$row['itemPrice']."</td><td>Avilibility: ".$row['itemAvil']." </td></tr>"; echo "<tr><td width=150>Catagory: ".$row['itemCat']."</td><td width=150>Sub-Catagory:".$row['itemSub']."</td></tr>"; } echo "</table>";} Quote Link to comment Share on other sites More sharing options...
tet3828 Posted November 4, 2006 Author Share Posted November 4, 2006 [quote author=tet3828 link=topic=113841.msg462936#msg462936 date=1162666582]I am unable to retrieve the data that is sopposed to be posted by these forms.... any suggestions of why this is happening?function edit_what () {echo "Which value would you like to edit? <br />";echo "<form method='post' action='{$_SERVER['PHP_SELF']}'>";echo "<input type='hidden' name='id' value='{$_GET['id']}'>";echo "<input type='radio' name='edit' value='itemName'> Edit Name <br>";echo "<input type='radio' name='edit' value='itemDesc'> Edit Description<br />";echo "<input type='radio' name='edit' value='itemPrice'> Edit Price <br />";echo "<input type='radio' name='edit' value='itemAvil'> Edit Avialibilty<br />";echo "<input type=submit name=submit value=Submit /></form>";}[/quote] Quote Link to comment Share on other sites More sharing options...
bljepp69 Posted November 4, 2006 Share Posted November 4, 2006 It's a bit difficult to follow, but if you are talking about not being able to retrieve values after the form shown in the "edit_what()" function is submitted, it's probably because your form is a "POST" form and so $_GET['id'] becomes $_POST['id'] Quote Link to comment Share on other sites More sharing options...
tet3828 Posted November 4, 2006 Author Share Posted November 4, 2006 It just "becomes" POST['id'] after it leaves the function? or do change the script to read POST['id']? Quote Link to comment Share on other sites More sharing options...
bljepp69 Posted November 4, 2006 Share Posted November 4, 2006 if your function "display_item()" gets called after the user clicks "Submit" on the form, then change the value for $id in the display_item() function to :$id = $_POST['id'];I'm just making an assumption that is how the code flows. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.