Jump to content

How To Create Php Dyanmic Textboxes...and Submit With 1 Submit Button?


Stalingrad

Recommended Posts

Hi. I am trying to create a form, well I already have and it isn't working. What I am trying to do is update multiple rows of the SAME field name with a text box displayed for each row that exists. Everything is displayed okay, but the submit button doesn't even load the page or anything.. it doesn't do anything for one thing. Even if it did, I know it wouldn't work. So my question is this... how can I update all of the displayed boxes at once with only ONE submit button? I'm thinking maybe I have something missing or something else is wrong... or maybe both! Here is my code for this piece:

 

if($action == "stock") {
$setprice = $_POST['price'];
$updateprice = $_POST['updateprice'];
echo "<a href=?action=edit>Edit Shop</a> | <a href=?action=view&user=$showusername>View Shop</a> | <a href=?action=stock>View Stock</a> | <a href=?action=quick>Quick Stock</a><br><br><font size=5>Stock Shop</font><br><br>";
$eq = "SELECT * FROM uitems WHERE username='$showusername' AND location='2' GROUP BY theitemid";
$ee = mysql_query($eq);
while($erow = mysql_fetch_array($ee)) {
$eeloc = $erow['location'];
$eeid = $erow['theitemid'];
$eenowid = $erow['uitemid'];
$eeprice = $erow['price'];
$wq = "SELECT * FROM items WHERE itemid='$eeid'";
$ww = mysql_query($wq);
while($wrow = mysql_fetch_array($ww)) {
$cq = mysql_query("SELECT * FROM uitems WHERE username='$showusername' AND location='2' AND theitemid='$eeid'");
$lcq = mysql_num_rows($cq);
$fid = $wrow['itemid'];
$fname = $wrow['name'];
$fimage = $wrow['image'];
$frarity = $wrow['rarity'];
$fdesc = $wrow['description'];
echo "<br>$fname<br><img src=/images/items/$fimage><br><br>";
?>
<input type="text" name="price" value="<?php echo "$eeprice"; ?>"><br></form>
<?php
}
?>
<?php
}
?>
<br><br><input type="submit" name="updateprice" value="Update Prices"><br><br>
<form action="<?php echo "$PHP_SELF"; ?>" method="POST"></form>
<?php
if(isset($setprice)) {
mysql_query("UPDATE uitems SET price='$setprice' WHERE username='$showusername' AND theitemid='$fid'");
echo "<font color=green>Success! Your prices have been set and updated!</font><br><br>";
}
}

 

Please, somebody help with this. I have been stuck on this page for so long now. I gave up a looong time ago, now I am going back trying to solve the issues. Thank you. :) Also, please keep it simple and not confusing, thanks! :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.