Hi,
I'm trying to get a page to repost to a page (while updating an SQL table) carry that information to another part of the page and use that to update other relevant tables
I had it working for a bit, but not anymore
Here is the code, any suggestion would be appreciated
<?php include("code/header.html"); ?>
<?php include("code/connect.php"); ?>
<?php include("code/links.html"); ?>
<?php
/////////////////Select Data/////////////////
include 'baaSelect.php';
$sel = new baaSelect();
$sel->addSelect('mealtype', 'mealtypes', 'typeID', 'typeName','',1,'--Select--');
$sel->addSelect('meal', 'meals', 'MealID', 'mealName','typeID',1,'----------Select----------');
$sel->makeScript();
//////////////////////////////////////////////
/////////////////Meal Type////////////////////
$sql_options="SELECT typeID, typeName FROM mealtypes ORDER BY typeID";
$result_options=mysql_query($sql_options);
$type_options="";
while ($row=mysql_fetch_array($result_options))
{
$typeid=$row["typeID"];
$typename=$row["typeName"];
$type_options.="<OPTION VALUE=\"$typeid\">".$typename;
}
//////////////////////////////////////////////
////////Insert Recipe Name, Meal Type/////////
if (isset($_POST[recipe_name]) && isset($_POST[add_type]))
{
$SQL5 = "INSERT INTO meals(mealName, typeID)
VALUES ('$_POST[recipe_name]', '$_POST[add_type]')";
if (!mysql_query($SQL5, $con))
{ die('Error: ' . mysql_error()); }
echo "1 unit added";
//$SQL78 = mysql_fetch_array($SQL77);
//$SQL99 = $SQL78['mealID'];
$SQL77 = mysql_query("SELECT * FROM meals WHERE mealName='$_POST[recipe_name]'");
while($row = mysql_fetch_array($SQL77))
{
echo $row['mealID'] ;
echo "<br />";
}
}
/////////////Insert Description////////////////
if (isset($_POST[recipe_name2]))
{
$SQL10 = "UPDATE meals SET RecDesc = '$_POST[desc2]' WHERE mealName = '$_POST[recipe_name2]'";
if (!mysql_query($SQL10, $con))
{ die('Error: ' . mysql_error());}
echo "1 description added";
}
echo $SQL99;
?>
<center>
<table border="0">
<tr>
<td>
<?php include("recipe_table1.php"); ?>
</td>
<td>
<?php include("recipe_table2.php"); ?>
</td>
<tr>
</table>
</center>
<?php include("code/footer.php"); ?>
<table frame="border" border="1">
<tr>
<td colspan="4">
<form action="recipe.php" method="post">
Recipe Name: <br> <input type="text" name="recipe_name" size="80" />
</td>
</tr>
<tr>
<td>
# of Ingredients: <br> <input type="text" name="amount_ingred" size="1"/>
</td>
<td colspan="2">
Meal Type:
<br>
<select name="add_type">
<option><?php echo $type_options?></option>
</select>
</td>
<td>
Input:
<br>
<input type="submit" value="Confirm" />
</form>
</td>
</tr>
<tr>
<td colspan="4">
<form action="recipe.php" method="post">
Recipe Name: <br> <input name="recipe_name2" type="text" value="<?php echo $SQL100 ?>" size="80" />
</td>
</tr>
<tr>
<td> Amt: </td>
<td> Unit: </td>
<td> Ingredient: </td>
<td><?php echo $SQL99; ?></td>
</tr>
<?php
if (isset($_POST[amount_ingred]))
{
//$result = mysql_query("SELECT * FROM recipeingredients WHERE MealID = '$_POST[meal]'");
for ($i=1; $i<=$_POST[amount_ingred]; $i++)
{
echo "<tr>";
echo "<td> <input type='text' name=" . NULL . " size=1 /></td>";
echo "<td><select><option>example</option></select> </td>";
echo "<td><select><option>description of the ingredients</option></select> </td>";
echo "</tr>";
}
}
?>
<tr>
<td colspan="4">
Directions: <br> <textarea name="desc2" cols="60" rows="10"> <?php echo $_POST[add_type]; echo $SQL77; ?></textarea>
</td>
</tr>
<tr>
<td colspan="3">
</td>
<td>
<input type="submit" value="Add" />
</form>
</td>
</tr>
</table>
http://www.phpbuilder.com/board/attachment.php?attachmentid=4017&stc=1&d=1267065285