Page 1 of 2
trouble with my edit form code
Posted: Tue Sep 29, 2009 12:29 am
by edawson003
Okay, based on the advice I got, I gave setting up an edit form a shot. I was able to get the form fields to populate with previously entered sql data, but after I click submit, nothing happens...no edit!!

Help?!?
Code: Select all
<?
if(isset($_GET['fid'])){
$fid=$_GET['fid'];
//connect to the database
$sql="SELECT * FROM MyTable WHERE itemid=" . $fid;
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$field1_r =$row['field1'];
$field2_r =$row['field2'];
$field3_r= $row['field3'];
$field4_r = $row['field4'];
}
}
function updateTable($field1, $field2, $field3, $field4) {
global $conn;
$q = "UPDATE MyTable SET field1 = $field1, field2 = $field2, field3 = $field3 , field4 = $field4 WHERE itemid=" . $fid;
return mysql_query($q,$conn);
}
<?
if(isset($_POST['submit'])){
if(!$_POST['field1']){
$reqerrors[] = "Yes";
$field1blankerror = "\t<br><span class=pred>You must enter a value.</span>\n";
}
if(isset($_POST['submit'])){
if(!$_POST['field2']){
$reqerrors[] = "Yes";
$field2blankerror = "\t<br><span class=pred>You must enter a value.</span>\n";
}
if(isset($_POST['submit'])){
if(!$_POST['field3']){
$reqerrors[] = "Yes";
$field3blankerror = "\t<br><span class=pred>You must enter a value.</span>\n";
}
if(isset($_POST['submit'])){
if(!$_POST['field4']){
$reqerrors[] = "Yes";
$field4blankerror = "\t<br><span class=pred>You must enter a value.</span>\n";
}
$field1 = mysql_real_escape_string($_POST['field1']);
$field2 = mysql_real_escape_string($_POST['field2']);
$field3 = mysql_real_escape_string($_POST['field3']);
$field4 = mysql_real_escape_string($_POST['field4']);
if(empty($reqerrors)){
$_SESSION['regresult'] = updateTable($field1, $field2, $field3, $field4);
ob_end_flush();
}
else {
$anyerror = "\t<div class=pred>ITEM UPDATE NOT YET SUBMITTED!</div>\n";
}
?>
and here is how the form input fields are populated with previously entered data:
Code: Select all
<input type="text" name="field1" maxlength="30" value="<?php echo isset($field1_r) ? $field1_r : ''; ?>" />
<? echo $servingunit2blankerror; ?>
and my form action:
Code: Select all
<form action="edit.php?fid=<? echo $fid; ?>" method="post">
Re: trouble with my edit form code
Posted: Tue Sep 29, 2009 11:58 pm
by edawson003
Any volunteers?
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 12:50 am
by s.dot
Check for SQL errors..
do mysql_query($query) or die(mysql_error());
Surround your field = $field with single quotes so they look like field1 = '$field1', field2 = '$field2'.. etc
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 2:44 am
by edawson003
Okay, I placed the single quotes and got this:
Code: Select all
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 3:09 am
by edawson003
Ok, I figured out what was happening that caused the last error and fixed it. Now, I'm not getting anymore mysql errors. But, when I click submt, no changes are saved. Instead trying to simplify my code for the sake of this post, I'm going plop the whole thing so you all can see it.
Now my actual code looks like this:
Code: Select all
<?
if(isset($_GET['fid'])){
$fid=$_GET['fid'];
//connect to the database
$sql="SELECT * FROM FoodLib WHERE foodid=" . $fid;
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$foodname =$row['foodname'];
$foodsubname =$row['foodsubname'];
$brand = $row['brand'];
$description = $row['description'];
$foodtype = $row['foodtype'];
$upccode = $row['upccode'];
$servingsize = $row['servingsize'];
$servingunits = $row['servingunits'];
$servingsize2 = $row['servingsize2'];
$servingunits2 = $row['servingunits2'];
$servingsize3 = $row['servingsize3'];
$servingunits3 = $row['servingunits3'];
$calories = $row['calories'];
$calfromfat = $row['calfromfat'];
$totalfat = $row['totalfat'];
$satfat = $row['satfat'];
$transfat = $row['transfat'];
$polyunsatfat = $row['polyunsatfat'];
$monounsatfat = $row['monounsatfat'];
$cholesterol = $row['cholesterol'];
$sodium = $row['sodium'];
$potassium = $row['potassium'];
$totalcarb = $row['totalcarb'];
$dietaryfiber = $row['dietaryfiber'];
$sugar = $row['sugar'];
$protein = $row['protein'];
$vita = $row['vita'];
$vitc = $row['vitc'];
$calcium = $row['calcium'];
$iron = $row['iron'];
$vitd = $row['vitd'];
$vite = $row['vite'];
$vitk = $row['vitk'];
$thiamin = $row['thiamin'];
$riboflavin = $row['riboflavin'];
$niacin = $row['niacin'];
$vitb6 = $row['vitb6'];
$folicacid = $row['folicacid'];
$vitb12 = $row['vitb12'];
$biotin = $row['biotin'];
$pantothenicacid = $row['pantothenicacid'];
$phosphorus = $row['phosphorus'];
$iodine = $row['iodine'];
$magnesium = $row['magnesium'];
$zinc = $row['zinc'];
$selenium = $row['selenium'];
$copper = $row['copper'];
$manganese = $row['manganese'];
$chromium = $row['chromium'];
$molybdenum = $row['molybdenum'];
$optionname = $row['optionname'];
}
}
?>
<?
if(isset($_POST['subjoin'])){
if(!$_POST['servingsize']){
$reqerrors[] = "Yes";
$servingsizeerror = "\t<br><span class=pred>You must enter amount of servings.</span>\n";
}
elseif(is_numeric($_POST['servingsize']) && $_POST['servingsize'] > 0) {
}
else {
$reqverrors[] = "Yes";
$servingsizeerror = "\t<br><span class=pred>Invalid value entered.</span>\n";
}
/* Make sure field is populated */
if(!$_POST['servingunits']){
$reqerrors[] = "Yes";
$servingunitblankerror = "\t<br><span class=pred>You must enter a serving units.</span>\n";
}
/* Once populated, make sure field is populated with letters and spaces only*/
elseif(!preg_match("/^([a-zA-Z])+$/", $_POST['servingunits'])) {
/* elseif(!preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["servingunits"])) { */
$reqverrors[] = "Yes";
$errName = "\t<br><span class=pred>Units must be from letters and spaces.</span>\n";
}
function updateFood()
{
/* Add the new account to the database */
$foodname = mysql_real_escape_string($_POST['foodname']);
$foodsubname = mysql_real_escape_string($_POST['foodsubname']);
$brand = mysql_real_escape_string($_POST['brand']);
$description = mysql_real_escape_string($_POST['description']);
$foodtype = $_POST['foodtype'];
$upccode = $_POST['upccode'];
$servingsize = trim($_POST['servingsize']);
$servingunits = trim($_POST['servingunits']);
$servingsize2 = $_POST['servingsize2'];
$servingunits2 = $_POST['servingunits2'];
$servingsize3 = $_POST['servingsize3'];
$servingunits3 = $_POST['servingunits3'];
$calories = trim($_POST['calories']);
$calfromfat = $_POST['calfromfat'];
$totalfat = $_POST['totalfat'];
$satfat = $_POST['satfat'];
$transfat = $_POST['transfat'];
$polyunsatfat = $_POST['polyunsatfat'];
$monounsatfat = $_POST['monounsatfat'];
$cholesterol = $_POST['cholesterol'];
$sodium = $_POST['sodium'];
$potassium = $_POST['potassium'];
$totalcarb = $_POST['totalcarb'];
$dietaryfiber = $_POST['dietaryfiber'];
$sugar = $_POST['sugar'];
$protein = $_POST['protein'];
$vita = $_POST['vita'];
$vitc = $_POST['vitc'];
$calcium = $_POST['calcium'];
$iron = $_POST['iron'];
$vitd = $_POST['vitd'];
$vite = $_POST['vite'];
$vitk = $_POST['vitk'];
$thiamin = $_POST['thiamin'];
$riboflavin = $_POST['riboflavin'];
$niacin = $_POST['niacin'];
$vitb6 = $_POST['vitb6'];
$folicacid = $_POST['folicacid'];
$vitb12 = $_POST['vitb12'];
$biotin = $_POST['biotin'];
$pantothenicacid = $_POST['pantothenicacid'];
$phosphorus = $_POST['phosphorus'];
$iodine = $_POST['iodine'];
$magnesium = $_POST['magnesium'];
$zinc = $_POST['zinc'];
$selenium = $_POST['selenium'];
$copper = $_POST['copper'];
$manganese = $_POST['manganese'];
$chromium = $_POST['chromium'];
$molybdenum = $_POST['molybdenum'];
$q = "UPDATE FoodLib SET foodname = '$foodname', foodsubname = '$foodsubname', brand = '$brand', description = '$description', foodtype = '$foodtype', upccode = '$upccode', servingsize = '$servingsize', servingunits = '$servingunits', servingsize = '$servingsize', servingunits = '$servingunits', servingsize = '$servingsize', servingunits = '$servingunits', calories = '$calories', calfromfat = '$calfromfat', totalfat = '$totalfat', satfat = '$satfat', transfat = '$transfat', polyunsatfat = '$polyunsatfat', monounsatfat = '$monounsatfat', cholesterol = '$cholesterol', sodium = '$sodium', potassium = '$potassium'
, totalcarb = '$totalcarb', dietaryfiber = '$dietaryfiber', sugar = '$sugar', protein = '$protein', vita = '$vita', vitc = '$vitc', calcium = '$calcium', iron = '$iron', vitd = '$vit', vite = '$vite', vitk = '$vitk', thiamin = '$thiamin', riboflavin = '$riboflavin', niacin = '$niacin', vitb6 = '$vitb6', folicacid = '$folicacid', vitb12 = '$vitb12', biotin = '$biotin', pantothenicacid = '$pantothenicacid', phosphorus = '$phosphorus', iodine = '$iodine', magnesium = '$magnesium', zinc = '$zinc', selenium = '$selenium', copper = '$copper', manganese = '$manganese', chromium = '$chromium'
, molybdenum = '$molybdenum' WHERE foodid = '$fid'";
$ureturn = mysql_query($q) or die(mysql_error());
}
if(empty($reqerrors) && empty($errors) && empty($reqverrors)){
updateFood();
}
else {
$anyerror = "\t<div class=pred>FOOD UPDATE NOT YET SUBMITTED!</div>\n";
}
if(empty($reqerrors)) {
}
else {
$reqberror = "\t<div class=pred><b>ERROR: </b>You didn't fill in a required field. See below.</div>\n";
}
if(empty($reqverrors)) {
}
else {
$reqverror = "\t<div class=pred><b>ERROR: </b>You entered an invalid value in a required field. See below.</div>\n";
}
if(empty($errors)) {
}
else {
$optverror = "\t<div class=pred><b>ERROR: </b>You entered an invalid value in an optional field. See below.</div>\n";
}
}
?>
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 9:40 am
by jackpf
Try var_dump() 'ing $ureturn.
See what it says.
Btw, there is no form in the code you posted :/Try putting
Code: Select all
var_dump(isset($_POST['subjoin']));
to see if it's even executing the query.
& thanks for the email lol.
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 11:20 am
by mayanktalwar1988
this is on your 4th line of your code you posted earlier
but there is no code for connecting to databse
where is it? not reached my eyes yet
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 2:32 pm
by edawson003
I left the code out for the form bcuz it was too long, but here it is.
Code: Select all
<form action="foodedit.php?fid=<? echo $fid; ?>" method="post">
<table width="871" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width=10> </td>
<td width=421 bgcolor=E57345>
<span class="p_b"><img src="../images/spacer10.gif" width="5" height="10">1)
Describe the New Food</span>
</td>
<td width=10> </td>
<td width=420 bgcolor=E57345>
<span class="p_b"><img src="../images/spacer10.gif" width="5" height="10">2)
Add the Nutrition Data</span>
</td>
<td width=10> </td>
</tr>
<tr>
<tr>
<td width=10><img src="../images/spacer10.gif" width="10" height="10"></td>
<td width=421><img src="../images/spacer10.gif" width="10" height="10"></td>
<td width=10><img src="../images/spacer10.gif" width="10" height="10"></td>
<td width=420><img src="../images/spacer10.gif" width="10" height="10"></td>
<td width=10><img src="../images/spacer10.gif" width="10" height="10"></td>
</tr>
<tr>
<td width=10> </td>
<td width=421 valign=top>
<table width="421" border="0" cellspacing="0" cellpadding="0" bgcolor=FFEBB0>
<tr>
<td width=120 align=right valign=top> </td>
<td width=5> </td>
<td width=286> </td>
</tr>
<tr>
<td align=right valign=top>
<p>Food Name<span class="pred">*</span>:</p>
</td>
<td> </td>
<td width=281>
<input type="text" STYLE="background-color: #FFF475;" name="foodname" maxlength="80" size="40" value="<?php echo isset($foodname) ? $foodname : ''; ?>" />
<? echo $foodnameblankerror; ?>
</td>
</tr>
<tr>
<td align=right>
<span class="p_g">Food Sub Name: </span>
</td>
<td> </td>
<td>
<input type="text" name="foodsubname" maxlength="80" size="40" value="<?php echo isset($foodsubname) ? $foodsubname : ''; ?>" />
</td>
</tr>
<tr>
<td align=right valign=top>
<span class="p_g">Description: </span>
</td>
<td> </td>
<td>
<textarea type="text" name="description" maxlength="8000" cols="30" rows="4"><?php echo isset($description) ? $description : ''; ?></textarea>
</td>
</tr>
<tr>
<td align=right valign=top>
<p>Brand<span class="pred">*</span>:</p>
</td>
<td> </td>
<td>
<input type="text" STYLE="background-color: #FFF475;" name="brand" maxlength="50" size="40" value="<?php echo isset($brand) ? $brand : ''; ?>" />
<? echo $brandblankerror; ?>
</td>
</tr>
<tr>
<td align=right valign=top>
<p>Food Type<span class="pred">*</span>:</p>
</td>
<td> </td>
<td>
<?
$optiondropdwnquery = "SELECT optionid, optionname FROM OptionsLib WHERE optiongroupid = 1";
$optionsavailresult = mysql_query($optiondropdwnquery);
$selectedValue = isset($foodtype) ? $foodtype : '';
echo '<select name="foodtype">' . "\n";
while ($row = mysql_fetch_array($optionsavailresult, MYSQL_ASSOC)) {
echo '<option STYLE="background-color: #FFF475;" value="' . $row['optionid']. '" ' . ($row['optionid']== $selectedValue ? 'selected="selected"' : '') . '>' . $row['optionname'] . '</option>' . "\n";
}
echo '</select>';
?>
<? echo $foodtypeblankerror; ?>
</td>
</tr>
<tr>
<td align=right> <span class="p_g">UPC Code:<br>
</span><span class="p_g">(if applicable) </span> </td>
<td> </td>
<td valign=top>
<input type="text" name="upccode" maxlength="30" value="<?php echo isset($upccode) ? $upccode : ''; ?>" />
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
<td width=10> </td>
<td width=420 valign=top>
<table width="420" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width=2 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=396 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=2 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
<tr>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=396 bgcolor=FFFFFF> </td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
<tr>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=396 bgcolor=FFFFFF><span class="ptitle_b"><b>Nutrition
Facts:</b></span> <span class="pred">* required field</span><br>
<br>
</td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
<tr>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=396 bgcolor=FFFFFF><table width="396" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width=200 height=10>
<h3>Amount Per Serving</h3>
</td>
<td height=10> </td>
</tr>
<tr>
<td height=5><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
<td height=5><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
</tr>
<tr>
<td align=left valign=top>
<p><b>Serving Size</b><span class="pred">*</span>:</p>
</td>
<td>
<input type="text" STYLE="background-color: #FFF475;" name="servingsize" maxlength="4" size="10" value="<?php echo isset($servingsize) ? $servingsize : ''; ?>" />
<? echo $servingsizeerror; ?>
</td>
</tr>
<tr>
<td align=left valign=top>
<p><b>Serving Units</b><span class="pred">*</span>: </p>
</td>
<td>
<input type="text" STYLE="background-color: #FFF475;" name="servingunits" maxlength="30" value="<?php echo isset($servingunits) ? $servingunits : ''; ?>" />
<? echo $servingunitblankerror; ?><? echo $errName; ?>
</td>
</tr>
<tr>
<td align=left valign=top> <span class="p_g">Alt.
Serving Size (optional):</span> </td>
<td>
<input type="text" name="servingsize2" maxlength="4" size="10" value="<?php echo isset($servingsize2) ? $servingsize2 : ''; ?>" />
<? echo $servingsize2error; ?>
</td>
</tr>
<tr>
<td align=left valign=top> <span class="p_g">Alt. Serving Units
(optional):</span> </td>
<td>
<input type="text" name="servingunits2" maxlength="30" value="<?php echo isset($servingunits2) ? $servingunits2 : ''; ?>" />
<? echo $servingunit2blankerror; ?>
</td>
</tr>
<tr>
<td align=left valign=top> <span class="p_g">Alt.
Serving Size (optional):</span> </td>
<td>
<input type="text" name="servingsize3" maxlength="4" size="10" value="<?php echo isset($servingsize3) ? $servingsize3 : ''; ?>" />
<? echo $servingsize3error; ?>
</td>
</tr>
<tr>
<td align=left valign=top> <span class="p_g">Alt. Serving Units
(optional):</span> </td>
<td>
<input type="text" name="servingunits3" maxlength="30" value="<?php echo isset($servingunits3) ? $servingunits3 : ''; ?>" />
<? echo $servingunit3blankerror; ?>
</td>
</tr>
<tr>
<td height=10><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
<td height=10><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
</tr>
<tr>
<td bgcolor=000000 height=3><SPACER TYPE="block" HEIGHT="3" WIDTH="3"></td>
<td bgcolor=000000 height=3><SPACER TYPE="block" HEIGHT="3" WIDTH="3"></td>
</tr>
<tr>
<td height=10><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
<td height=10><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
</tr>
<tr>
<td align=left valign=top>
<p><b>Calories</b><span class="pred">*</span>: </p>
</td>
<td>
<input type="text" STYLE="background-color: #FFF475;" name="calories" maxlength="30" value="<?php echo isset($calories) ? $calories : ''; ?>" /><? echo $calorieblankerror; ?>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<span class="pindent_g">Calories From Fat: </span>
</td>
<td>
<input type="text" name="calfromfat" maxlength="30" value="<?php echo isset($calfromfat) ? $calfromfat : ''; ?>" /><? echo $calfromfatentryerror; ?>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<p><b>Total Fat</b><span class="pred">*</span>: </p>
</td>
<td>
<p>
<input type="text" STYLE="background-color: #FFF475;" name="totalfat" maxlength="30" value="<?php echo isset($totalfat) ? $totalfat : ''; ?>" /> g<? echo $totalfaterror; ?>
</p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<div class="pindent_g">Saturated Fat:</div>
</td>
<td>
<p>
<input type="text" name="satfat" maxlength="30" value="<?php echo isset($satfat) ? $satfat : ''; ?>" />
<span class="p_g">g</span><? echo $satfatentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<div class="pindent_g">Trans Fat: </div>
</td>
<td>
<p>
<input type="text" name="transfat" maxlength="30" value="<?php echo isset($transfat) ? $transfat : ''; ?>" />
<span class="p_g">g</span><? echo $transfatentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<div class="pindent_g">Polyunsaturated Fat: </div>
</td>
<td valign=top>
<p>
<input type="text" name="polyunsatfat" maxlength="30" value="<?php echo isset($polyunsatfat) ? $polyunsatfat : ''; ?>" />
<span class="p_g">g</span><? echo $polyunsatfatentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<div class="pindent_g">Monounsaturated Fat:</div>
</td>
<td>
<p>
<input type="text" name="monounsatfat" maxlength="30" value="<?php echo isset($monounsatfat) ? $monounsatfat : ''; ?>" />
<span class="p_g">g</span><? echo $monounsatfatentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<p><b>Cholesterol:</b><span class="pred">*</span>: </p>
</td>
<td>
<p>
<input type="text" STYLE="background-color: #FFF475;" name="cholesterol" maxlength="30" value="<?php echo isset($cholesterol) ? $cholesterol : ''; ?>" />
mg<? echo $cholesterolerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td align=left valign=top>
<p><b>Sodium:</b><span class="pred">*</span>:</p>
</td>
<td>
<p>
<input type="text" STYLE="background-color: #FFF475;" name="sodium" maxlength="30" value="<?php echo isset($sodium) ? $sodium : ''; ?>" />
<span class="p_g">mg</span><? echo $sodiumentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td>
<span class="p_g">Potassium: </span>
</td>
<td valign=top>
<p>
<input type="text" name="potassium" maxlength="30" value="<?php echo isset($potassium) ? $potassium : ''; ?>" /> <span class="p_g">mg</span><? echo $potassiumentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td valign=top>
<p><b>Total Carbohydrate</b><span class="pred">*</span>:</p>
</td>
<td>
<p>
<input type="text" STYLE="background-color: #FFF475;" name="totalcarb" maxlength="30" value="<?php echo isset($totalcarb) ? $totalcarb : ''; ?>" /> g <? echo $totalcarberror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td valign=top>
<div class="pindent_g">Dietary Fiber:</div>
</td>
<td>
<p>
<input type="text" name="dietaryfiber" maxlength="30" value="<?php echo isset($dietaryfiber) ? $dietaryfiber : ''; ?>" /> <span class="p_g">g</span><? echo $dietaryfiberentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td valign=top>
<div class="pindent_g">Sugar:</div>
</td>
<td>
<p>
<input type="text" name="sugar" maxlength="30" value="<?php echo isset($sugar) ? $sugar : ''; ?>" /> <span class="p_g">g</span><? echo $sugarentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td valign=top><p><b>Protein</b><span class="pred">*</span>: </p></td>
<td>
<p>
<input type="text" STYLE="background-color: #FFF475;" name="protein" maxlength="30" value="<?php echo isset($protein) ? $protein : ''; ?>" /> g<? echo $proteinerror; ?></p>
</td>
</tr>
<tr>
<td height=5><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
<td height=5><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
</tr>
<tr>
<td height=3 bgcolor=000000><SPACER TYPE="block" HEIGHT="3" WIDTH="3"></td>
<td height=3 bgcolor=000000><SPACER TYPE="block" HEIGHT="3" WIDTH="3"></td>
</tr>
<tr>
<td height=5><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
<td height=5><SPACER TYPE="block" HEIGHT="5" WIDTH="5"></td>
</tr>
<tr>
<td><span class="p_g">Vitamin A: </span></td>
<td>
<p>
<input type="text" name="vita" maxlength="30" value="<?php echo isset($vita) ? $vita : ''; ?>" />
<span class="p_g">%</span><? echo $vitaentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Vitamin C: </span></td>
<td>
<p>
<input type="text" name="vitc" maxlength="30" value="<?php echo isset($vitc) ? $vitc : ''; ?>" />
<span class="p_g">%</span><? echo $vitcentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<p>
<td><span class="p_g">Calcium: </span></td>
<td>
<p>
<input type="text" name="calcium" maxlength="30" value="<?php echo isset($calcium) ? $calcium : ''; ?>" /> <span class="p_g">%</span>
<? echo $calciumentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Iron: </span></td>
<td>
<p><input type="text" name="iron" maxlength="30" value="<?php echo isset($iron) ? $iron : ''; ?>" /> <span class="p_g">%</span><? echo $ironentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
I will var_dump() 'ing $ureturn thing...
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 2:32 pm
by edawson003
form code continued...LOL
Code: Select all
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Vitamin D: </span></td>
<td>
<p>
<input type="text" name="vitd" maxlength="30" value="<?php echo isset($vitd) ? $vitd : ''; ?>" />
<span class="p_g">%</span><? echo $vitdentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Vitamin E: </span></td>
<td>
<p>
<input type="text" name="vite" maxlength="30" value="<?php echo isset($vite) ? $vite : ''; ?>" />
<span class="p_g">%</span><? echo $viteentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Vitamin K: </span></td>
<td>
<p>
<input type="text" name="vitk" maxlength="30" value="<?php echo isset($vitk) ? $vitk : ''; ?>" />
<span class="p_g">%</span><? echo $vitkentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Thiamin: </span></td>
<td>
<p>
<input type="text" name="thiamin" maxlength="30" value="<?php echo isset($thiamin) ? $thiamin : ''; ?>" />
<span class="p_g">%</span><? echo $thiaminentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Riboflavin: </span></td>
<td>
<p>
<input type="text" name="riboflavin" maxlength="30" value="<?php echo isset($riboflavin) ? $riboflavin : ''; ?>" />
<span class="p_g">%</span><? echo $riboflavinentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Niacin: </span></td>
<td>
<p>
<input type="text" name="niacin" maxlength="30" value="<?php echo isset($niacin) ? $niacin : ''; ?>" />
<span class="p_g">%</span><? echo $niacinentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Vitamin B6: </span></td>
<td>
<p>
<input type="text" name="vitb6" maxlength="30" value="<?php echo isset($vitb6) ? $vitb6 : ''; ?>" />
<span class="p_g">%</span><? echo $vitb6entryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Folic Acid/Folate: </span></td>
<td>
<p>
<input type="text" name="folicacid" maxlength="30" value="<?php echo isset($folicacid) ? $folicacid : ''; ?>" />
<span class="p_g">%</span><? echo $folicacidentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Vitamin B12: </span></td>
<td>
<p>
<input type="text" name="vitb12" maxlength="30" value="<?php echo isset($vitb12) ? $vitb12 : ''; ?>" />
<span class="p_g">%</span><? echo $vitb12entryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Biotin: </span></td>
<td>
<p>
<input type="text" name="biotin" maxlength="30" value="<?php echo isset($biotin) ? $biotin : ''; ?>" />
<span class="p_g">%</span><? echo $biotinentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Pantothenic Acid: </span></td>
<td>
<p>
<input type="text" name="pantothenicacid" maxlength="30" value="<?php echo isset($pantothenicacid) ? $pantothenicacid : ''; ?>" />
<span class="p_g">%</span><? echo $pantothenicacidentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Phosphorus: </span></td>
<td>
<p>
<input type="text" name="phosphorus" maxlength="30" value="<?php echo isset($phosphorus) ? $phosphorus : ''; ?>" />
<span class="p_g">%</span><? echo $phosphorusentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Iodine: </span></td>
<td>
<p>
<input type="text" name="iodine" maxlength="30" value="<?php echo isset($iodine) ? $iodine : ''; ?>" />
<span class="p_g">%</span><? echo $iodineentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Magnesium: </span></td>
<td>
<p>
<input type="text" name="magnesium" maxlength="30" value="<?php echo isset($magnesium) ? $magnesium : ''; ?>" />
<span class="p_g">%</span><? echo $magnesiumentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Zinc: </span></td>
<td>
<p>
<input type="text" name="zinc" maxlength="30" value="<?php echo isset($zinc) ? $zinc : ''; ?>" />
<span class="p_g">%</span><? echo $zincentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Selenium: </span></td>
<td>
<p>
<input type="text" name="selenium" maxlength="30" value="<?php echo isset($selenium) ? $selenium : ''; ?>" />
<span class="p_g">%</span><? echo $seleniumentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Copper: </span></td>
<td>
<p>
<input type="text" name="copper" maxlength="30" value="<?php echo isset($copper) ? $copper : ''; ?>" />
<span class="p_g">%</span><? echo $copperentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Manganese: </span></td>
<td>
<p>
<input type="text" name="manganese" maxlength="30" value="<?php echo isset($manganese) ? $manganese : ''; ?>" />
<span class="p_g">%</span><? echo $manganeseentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Chromium:</span></td>
<td>
<p>
<input type="text" name="chromium" maxlength="30" value="<?php echo isset($chromium) ? $chromium : ''; ?>" />
<span class="p_g">%</span><? echo $chromiumentryerror; ?></p>
</td>
</tr>
<tr name=nutriseparator>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr>
<tr>
<td align=left valign=top height=1 bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
<td bgcolor=666666><img src="../images/spacer10.gif" width="1" height="1"></td>
</tr>
<tr>
<td align=left valign=top height=5><img src="../images/spacer10.gif" width="5" height="5"></td>
<td><img src="../images/spacer10.gif" width="5" height="5"></td>
</tr name=nutriseparator_end>
<tr>
<td><span class="p_g">Molybdenum: </span></td>
<td>
<p>
<input type="text" name="molybdenum" maxlength="30" value="<?php echo isset($molybdenum) ? $molybdenum : ''; ?>" />
<span class="p_g">%</span><? echo $molybdenumentryerror; ?></p>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="subjoin" value="Submit!"></td>
</tr>
</table>
</td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
<tr>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=396 bgcolor=FFFFFF> </td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
<tr>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=396 bgcolor=FFFFFF> </td>
<td width=10 bgcolor=FFFFFF> </td>
<td width=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
<tr>
<td width=2 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=396 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=10 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
<td width=2 height=2 bgcolor=000000><spacer type="block" height="2" width="2"></td>
</tr>
</table>
</td>
<td width=10> </td>
</tr>
</table>
</form>
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 2:36 pm
by edawson003
I include in the sql db connection code from another file. So far so good it seems to be work fine. I used it for my initial data entry form.
Code: Select all
<? include("../database.php"); ?>
Code: Select all
<?
/**
* Connect to the mysql database.
*/
$conn = mysql_connect("localhost", "login", "password") or die(mysql_error());
mysql_select_db('database', $conn) or die(mysql_error());
?>
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 4:15 pm
by jackpf
what did the var dumps show?
Re: trouble with my edit form code
Posted: Wed Sep 30, 2009 8:04 pm
by edawson003
When I ran <? var_dump($ureturn); ?> it returned NULL
When I ran <? var_dump(isset($_POST['subjoin'])); ?> it returned bool(true)
Re: trouble with my edit form code
Posted: Thu Oct 01, 2009 3:15 am
by jackpf
What does this display?
Code: Select all
<?
if(isset($_GET['fid'])){
$fid=$_GET['fid'];
//connect to the database
$sql="SELECT * FROM FoodLib WHERE foodid=" . $fid;
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$foodname =$row['foodname'];
$foodsubname =$row['foodsubname'];
$brand = $row['brand'];
$description = $row['description'];
$foodtype = $row['foodtype'];
$upccode = $row['upccode'];
$servingsize = $row['servingsize'];
$servingunits = $row['servingunits'];
$servingsize2 = $row['servingsize2'];
$servingunits2 = $row['servingunits2'];
$servingsize3 = $row['servingsize3'];
$servingunits3 = $row['servingunits3'];
$calories = $row['calories'];
$calfromfat = $row['calfromfat'];
$totalfat = $row['totalfat'];
$satfat = $row['satfat'];
$transfat = $row['transfat'];
$polyunsatfat = $row['polyunsatfat'];
$monounsatfat = $row['monounsatfat'];
$cholesterol = $row['cholesterol'];
$sodium = $row['sodium'];
$potassium = $row['potassium'];
$totalcarb = $row['totalcarb'];
$dietaryfiber = $row['dietaryfiber'];
$sugar = $row['sugar'];
$protein = $row['protein'];
$vita = $row['vita'];
$vitc = $row['vitc'];
$calcium = $row['calcium'];
$iron = $row['iron'];
$vitd = $row['vitd'];
$vite = $row['vite'];
$vitk = $row['vitk'];
$thiamin = $row['thiamin'];
$riboflavin = $row['riboflavin'];
$niacin = $row['niacin'];
$vitb6 = $row['vitb6'];
$folicacid = $row['folicacid'];
$vitb12 = $row['vitb12'];
$biotin = $row['biotin'];
$pantothenicacid = $row['pantothenicacid'];
$phosphorus = $row['phosphorus'];
$iodine = $row['iodine'];
$magnesium = $row['magnesium'];
$zinc = $row['zinc'];
$selenium = $row['selenium'];
$copper = $row['copper'];
$manganese = $row['manganese'];
$chromium = $row['chromium'];
$molybdenum = $row['molybdenum'];
$optionname = $row['optionname'];
}
}
?>
<?
if(isset($_POST['subjoin'])){
if(!$_POST['servingsize']){
$reqerrors[] = "Yes";
$servingsizeerror = "\t<br><span class=pred>You must enter amount of servings.</span>\n";
}
elseif(is_numeric($_POST['servingsize']) && $_POST['servingsize'] > 0) {
}
else {
$reqverrors[] = "Yes";
$servingsizeerror = "\t<br><span class=pred>Invalid value entered.</span>\n";
}
/* Make sure field is populated */
if(!$_POST['servingunits']){
$reqerrors[] = "Yes";
$servingunitblankerror = "\t<br><span class=pred>You must enter a serving units.</span>\n";
}
/* Once populated, make sure field is populated with letters and spaces only*/
elseif(!preg_match("/^([a-zA-Z])+$/", $_POST['servingunits'])) {
/* elseif(!preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["servingunits"])) { */
$reqverrors[] = "Yes";
$errName = "\t<br><span class=pred>Units must be from letters and spaces.</span>\n";
}
function updateFood()
{
/* Add the new account to the database */
$foodname = mysql_real_escape_string($_POST['foodname']);
$foodsubname = mysql_real_escape_string($_POST['foodsubname']);
$brand = mysql_real_escape_string($_POST['brand']);
$description = mysql_real_escape_string($_POST['description']);
$foodtype = $_POST['foodtype'];
$upccode = $_POST['upccode'];
$servingsize = trim($_POST['servingsize']);
$servingunits = trim($_POST['servingunits']);
$servingsize2 = $_POST['servingsize2'];
$servingunits2 = $_POST['servingunits2'];
$servingsize3 = $_POST['servingsize3'];
$servingunits3 = $_POST['servingunits3'];
$calories = trim($_POST['calories']);
$calfromfat = $_POST['calfromfat'];
$totalfat = $_POST['totalfat'];
$satfat = $_POST['satfat'];
$transfat = $_POST['transfat'];
$polyunsatfat = $_POST['polyunsatfat'];
$monounsatfat = $_POST['monounsatfat'];
$cholesterol = $_POST['cholesterol'];
$sodium = $_POST['sodium'];
$potassium = $_POST['potassium'];
$totalcarb = $_POST['totalcarb'];
$dietaryfiber = $_POST['dietaryfiber'];
$sugar = $_POST['sugar'];
$protein = $_POST['protein'];
$vita = $_POST['vita'];
$vitc = $_POST['vitc'];
$calcium = $_POST['calcium'];
$iron = $_POST['iron'];
$vitd = $_POST['vitd'];
$vite = $_POST['vite'];
$vitk = $_POST['vitk'];
$thiamin = $_POST['thiamin'];
$riboflavin = $_POST['riboflavin'];
$niacin = $_POST['niacin'];
$vitb6 = $_POST['vitb6'];
$folicacid = $_POST['folicacid'];
$vitb12 = $_POST['vitb12'];
$biotin = $_POST['biotin'];
$pantothenicacid = $_POST['pantothenicacid'];
$phosphorus = $_POST['phosphorus'];
$iodine = $_POST['iodine'];
$magnesium = $_POST['magnesium'];
$zinc = $_POST['zinc'];
$selenium = $_POST['selenium'];
$copper = $_POST['copper'];
$manganese = $_POST['manganese'];
$chromium = $_POST['chromium'];
$molybdenum = $_POST['molybdenum'];
$q = "UPDATE FoodLib SET foodname = '$foodname', foodsubname = '$foodsubname', brand = '$brand', description = '$description', foodtype = '$foodtype', upccode = '$upccode', servingsize = '$servingsize', servingunits = '$servingunits', servingsize = '$servingsize', servingunits = '$servingunits', servingsize = '$servingsize', servingunits = '$servingunits', calories = '$calories', calfromfat = '$calfromfat', totalfat = '$totalfat', satfat = '$satfat', transfat = '$transfat', polyunsatfat = '$polyunsatfat', monounsatfat = '$monounsatfat', cholesterol = '$cholesterol', sodium = '$sodium', potassium = '$potassium'
, totalcarb = '$totalcarb', dietaryfiber = '$dietaryfiber', sugar = '$sugar', protein = '$protein', vita = '$vita', vitc = '$vitc', calcium = '$calcium', iron = '$iron', vitd = '$vit', vite = '$vite', vitk = '$vitk', thiamin = '$thiamin', riboflavin = '$riboflavin', niacin = '$niacin', vitb6 = '$vitb6', folicacid = '$folicacid', vitb12 = '$vitb12', biotin = '$biotin', pantothenicacid = '$pantothenicacid', phosphorus = '$phosphorus', iodine = '$iodine', magnesium = '$magnesium', zinc = '$zinc', selenium = '$selenium', copper = '$copper', manganese = '$manganese', chromium = '$chromium'
, molybdenum = '$molybdenum' WHERE foodid = '$fid'";
$ureturn = mysql_query($q) or die(mysql_error());
die(var_dump($ureturn), mysql_affected_rows());
}
if(empty($reqerrors) && empty($errors) && empty($reqverrors)){
updateFood();
}
else {
$anyerror = "\t<div class=pred>FOOD UPDATE NOT YET SUBMITTED!</div>\n";
}
if(empty($reqerrors)) {
}
else {
$reqberror = "\t<div class=pred><b>ERROR: </b>You didn't fill in a required field. See below.</div>\n";
}
if(empty($reqverrors)) {
}
else {
$reqverror = "\t<div class=pred><b>ERROR: </b>You entered an invalid value in a required field. See below.</div>\n";
}
if(empty($errors)) {
}
else {
$optverror = "\t<div class=pred><b>ERROR: </b>You entered an invalid value in an optional field. See below.</div>\n";
}
}
?>
Re: trouble with my edit form code
Posted: Thu Oct 01, 2009 2:23 pm
by edawson003
I get
Parse error: syntax error, unexpected ',' in /home/claudett/public_html/membersarea/foodeditx.php on line 498
.
I will check for any little syntax slips later. Checking this stuff in between lunch breaks.

Re: trouble with my edit form code
Posted: Thu Oct 01, 2009 3:42 pm
by jackpf
Oops, bracket in the wrong place. I did it at college so I didn't have syntax highlighting ^^
Code: Select all
<?
if(isset($_GET['fid'])){
$fid=$_GET['fid'];
//connect to the database
$sql="SELECT * FROM FoodLib WHERE foodid=" . $fid;
//-run the query against the mysql query function
$result=mysql_query($sql);
//-create while loop and loop through result set
while($row=mysql_fetch_array($result)){
$foodname =$row['foodname'];
$foodsubname =$row['foodsubname'];
$brand = $row['brand'];
$description = $row['description'];
$foodtype = $row['foodtype'];
$upccode = $row['upccode'];
$servingsize = $row['servingsize'];
$servingunits = $row['servingunits'];
$servingsize2 = $row['servingsize2'];
$servingunits2 = $row['servingunits2'];
$servingsize3 = $row['servingsize3'];
$servingunits3 = $row['servingunits3'];
$calories = $row['calories'];
$calfromfat = $row['calfromfat'];
$totalfat = $row['totalfat'];
$satfat = $row['satfat'];
$transfat = $row['transfat'];
$polyunsatfat = $row['polyunsatfat'];
$monounsatfat = $row['monounsatfat'];
$cholesterol = $row['cholesterol'];
$sodium = $row['sodium'];
$potassium = $row['potassium'];
$totalcarb = $row['totalcarb'];
$dietaryfiber = $row['dietaryfiber'];
$sugar = $row['sugar'];
$protein = $row['protein'];
$vita = $row['vita'];
$vitc = $row['vitc'];
$calcium = $row['calcium'];
$iron = $row['iron'];
$vitd = $row['vitd'];
$vite = $row['vite'];
$vitk = $row['vitk'];
$thiamin = $row['thiamin'];
$riboflavin = $row['riboflavin'];
$niacin = $row['niacin'];
$vitb6 = $row['vitb6'];
$folicacid = $row['folicacid'];
$vitb12 = $row['vitb12'];
$biotin = $row['biotin'];
$pantothenicacid = $row['pantothenicacid'];
$phosphorus = $row['phosphorus'];
$iodine = $row['iodine'];
$magnesium = $row['magnesium'];
$zinc = $row['zinc'];
$selenium = $row['selenium'];
$copper = $row['copper'];
$manganese = $row['manganese'];
$chromium = $row['chromium'];
$molybdenum = $row['molybdenum'];
$optionname = $row['optionname'];
}
}
?>
<?
if(isset($_POST['subjoin'])){
if(!$_POST['servingsize']){
$reqerrors[] = "Yes";
$servingsizeerror = "\t<br><span class=pred>You must enter amount of servings.</span>\n";
}
elseif(is_numeric($_POST['servingsize']) && $_POST['servingsize'] > 0) {
}
else {
$reqverrors[] = "Yes";
$servingsizeerror = "\t<br><span class=pred>Invalid value entered.</span>\n";
}
/* Make sure field is populated */
if(!$_POST['servingunits']){
$reqerrors[] = "Yes";
$servingunitblankerror = "\t<br><span class=pred>You must enter a serving units.</span>\n";
}
/* Once populated, make sure field is populated with letters and spaces only*/
elseif(!preg_match("/^([a-zA-Z])+$/", $_POST['servingunits'])) {
/* elseif(!preg_match("/^[A-Z][a-zA-Z -]+$/", $_POST["servingunits"])) { */
$reqverrors[] = "Yes";
$errName = "\t<br><span class=pred>Units must be from letters and spaces.</span>\n";
}
function updateFood()
{
/* Add the new account to the database */
$foodname = mysql_real_escape_string($_POST['foodname']);
$foodsubname = mysql_real_escape_string($_POST['foodsubname']);
$brand = mysql_real_escape_string($_POST['brand']);
$description = mysql_real_escape_string($_POST['description']);
$foodtype = $_POST['foodtype'];
$upccode = $_POST['upccode'];
$servingsize = trim($_POST['servingsize']);
$servingunits = trim($_POST['servingunits']);
$servingsize2 = $_POST['servingsize2'];
$servingunits2 = $_POST['servingunits2'];
$servingsize3 = $_POST['servingsize3'];
$servingunits3 = $_POST['servingunits3'];
$calories = trim($_POST['calories']);
$calfromfat = $_POST['calfromfat'];
$totalfat = $_POST['totalfat'];
$satfat = $_POST['satfat'];
$transfat = $_POST['transfat'];
$polyunsatfat = $_POST['polyunsatfat'];
$monounsatfat = $_POST['monounsatfat'];
$cholesterol = $_POST['cholesterol'];
$sodium = $_POST['sodium'];
$potassium = $_POST['potassium'];
$totalcarb = $_POST['totalcarb'];
$dietaryfiber = $_POST['dietaryfiber'];
$sugar = $_POST['sugar'];
$protein = $_POST['protein'];
$vita = $_POST['vita'];
$vitc = $_POST['vitc'];
$calcium = $_POST['calcium'];
$iron = $_POST['iron'];
$vitd = $_POST['vitd'];
$vite = $_POST['vite'];
$vitk = $_POST['vitk'];
$thiamin = $_POST['thiamin'];
$riboflavin = $_POST['riboflavin'];
$niacin = $_POST['niacin'];
$vitb6 = $_POST['vitb6'];
$folicacid = $_POST['folicacid'];
$vitb12 = $_POST['vitb12'];
$biotin = $_POST['biotin'];
$pantothenicacid = $_POST['pantothenicacid'];
$phosphorus = $_POST['phosphorus'];
$iodine = $_POST['iodine'];
$magnesium = $_POST['magnesium'];
$zinc = $_POST['zinc'];
$selenium = $_POST['selenium'];
$copper = $_POST['copper'];
$manganese = $_POST['manganese'];
$chromium = $_POST['chromium'];
$molybdenum = $_POST['molybdenum'];
$q = "UPDATE FoodLib SET foodname = '$foodname', foodsubname = '$foodsubname', brand = '$brand', description = '$description', foodtype = '$foodtype', upccode = '$upccode', servingsize = '$servingsize', servingunits = '$servingunits', servingsize = '$servingsize', servingunits = '$servingunits', servingsize = '$servingsize', servingunits = '$servingunits', calories = '$calories', calfromfat = '$calfromfat', totalfat = '$totalfat', satfat = '$satfat', transfat = '$transfat', polyunsatfat = '$polyunsatfat', monounsatfat = '$monounsatfat', cholesterol = '$cholesterol', sodium = '$sodium', potassium = '$potassium'
, totalcarb = '$totalcarb', dietaryfiber = '$dietaryfiber', sugar = '$sugar', protein = '$protein', vita = '$vita', vitc = '$vitc', calcium = '$calcium', iron = '$iron', vitd = '$vit', vite = '$vite', vitk = '$vitk', thiamin = '$thiamin', riboflavin = '$riboflavin', niacin = '$niacin', vitb6 = '$vitb6', folicacid = '$folicacid', vitb12 = '$vitb12', biotin = '$biotin', pantothenicacid = '$pantothenicacid', phosphorus = '$phosphorus', iodine = '$iodine', magnesium = '$magnesium', zinc = '$zinc', selenium = '$selenium', copper = '$copper', manganese = '$manganese', chromium = '$chromium'
, molybdenum = '$molybdenum' WHERE foodid = '$fid'";
$ureturn = mysql_query($q) or die(mysql_error());
die(var_dump($ureturn, mysql_affected_rows()));
}
if(empty($reqerrors) && empty($errors) && empty($reqverrors)){
updateFood();
}
else {
$anyerror = "\t<div class=pred>FOOD UPDATE NOT YET SUBMITTED!</div>\n";
}
if(empty($reqerrors)) {
}
else {
$reqberror = "\t<div class=pred><b>ERROR: </b>You didn't fill in a required field. See below.</div>\n";
}
if(empty($reqverrors)) {
}
else {
$reqverror = "\t<div class=pred><b>ERROR: </b>You entered an invalid value in a required field. See below.</div>\n";
}
if(empty($errors)) {
}
else {
$optverror = "\t<div class=pred><b>ERROR: </b>You entered an invalid value in an optional field. See below.</div>\n";
}
}
?>