Hi! This may sound confusing, and I hope that I worded the title right, but I have a very complex form that I’ve been asking around on many different forum for, and trying for for several years now… I’ve basically been trying to update multiple rows with one submit button. I have several items displayed, and you type in the amount you want to display, and press “Submit”. It will not update the amount you put it in for, it shows up blank. I will copy and paste my code below. I know it is confusing, but I am at wits end with this coding… it is stopping me from a wonderful website. Also, if anybody can also help me out and show me how to do it and/or tell me the style/example I need to follow so I can look the function/example up please tell me! I have looked in every PHP book and SQL book I own! Nothing comes up.
I have re-written it at least 10 times, and still a dead end. Here is my code:
[php]<?php
session_start();
include(“FILE.php”);
?>
You are not Logged In! Please Login or Register to Continue!"; } if(isset($_SESSION['username'])) { echo "
"; $action = $_GET['action']; $tusery = $_GET['user']; if(!isset($action)) { echo "Edit Shop | View Shop | View Stock | Quick Stock
"; } if(isset($action)) { $getshopq = "SELECT * FROM usershops WHERE owner='$suserid'"; $getshop = mysql_query($getshopq); while($tri = mysql_fetch_array($getshop)) { $theid = $tri['ushopid']; $owner = $tri ['owner']; $desc = $tri['description']; $image = $tri['image']; $name = $tri['name']; $status = $tri['status']; $discount = $tri['discount']; } if($action == "edit") { echo "Edit Shop | View Shop | View Stock | Quick Stock
Edit Shop
"; ?> " method="POST"> <?php $create = $_POST['create']; $thename = $_POST['thename']; $thedesc = $_POST['thedesc']; $thestatus = $_POST['thestatus']; $theimage = $_POST['theimage'];
?>
" method="POST"> Shop Name:Description
Status: Open Closed Gallery
<?php if(isset($create)) { if($thename == "" || $thedesc == "") { echo "Error! Please fill out the entire form!
"; ?> " method="POST"> Shop Name:
Description
Status: Open Closed Gallery
<?php }
if($thename != “” && $thedesc != “”) {
$citsq = mysql_query(“SELECT * FROM usershops WHERE owner=’$suserid’”);
$cits = mysql_num_rows($citsq);
if($cits != “0”) {
mysql_query(“UPDATE usershops SET description=’$thedesc’ WHERE owner=’$suserid’”);
mysql_query(“UPDATE usershops SET name=’$thename’ WHERE owner=’$suserid’”);
mysql_query(“UPDATE usershops SET status=’$thestatus’ WHERE owner=’$suserid’”);
echo “Success! You have created your shop! Click <a href=?action=view>here to view it.
”;
}
}
if($cits == “0”) {
mysql_query(“INSERT INTO usershops (owner, name, description, image, status, discount) VALUES (’$suserid’, ‘$thename’, ‘$thedesc’, ‘pinkapple.gif’, ‘$thestatus’, ‘None’)”);
echo “Success! You have created your shop!
”;
}
}
}
if($action == “view”) {
$vcount = 0;
$yuko = 4;
echo “<a href=?action=edit>Edit Shop | <a href=?action=view&user=$suserid>View Shop | <a href=?action=stock>View Stock | <a href=?action=quick>Quick Stock
”;
$gaq = “SELECT * FROM usershops WHERE owner=’$tusery’”;
$sq = mysql_query($gaq);
while($pon = mysql_fetch_array($sq)) {
$hn = $pon[‘name’];
$hi = $pon[‘image’];
$hg = $pon[‘description’];
$ho = $pon[‘owner’];
$hs = $pon[‘status’];
$hdi = $pon[‘discount’];
$hid = $pon[‘ushopid’];
echo “$hn
$hg
”;
}
echo “
<a href=usershops.php?action=view&buy=$umid> $myname Price: $umprice | ”;