Quote:
<?php
// include database connection file
include_once("../../config.php");
// Check if form is submitted for recipe update, then redirect to homepage after update
if(isset($_POST['update']))
{
$RecipeID = $_POST['RecipeID'];
$Title=$_POST['Title'];
$Ingredients=$_POST['Ingredients'];
$Method=$_POST['Method'];
$Category=$_POST['Category'];
$Edit=$_POST['Edit'];
// update recipe data
$result = mysqli_query($mysqli, "UPDATE Recipe SET Title='$Title',Ingredients='$Ingredients',Method=' $Method',Category='$Category',Edit='$Edit' WHERE RecipeID=$RecipeID");
// Redirect to homepage to display updated recipe in list
header("Location: /blah/blah/domain.com/manage/index.php");
}
?>
<?php
// Display selected recipe data based on id
// Getting id from url
$RecipeID = $_GET['RecipeID'];
// Fetech recipe data based on id
$result = mysqli_query($mysqli, "SELECT * FROM Recipe WHERE RecipeID=$RecipeID");
while($recipe_data = mysqli_fetch_array($result))
{
$Title=$recipe_data['Title'];
$Ingredients=$recipe_data['Ingredients'];
$Method=$recipe_data['Method'];
$Category=$recipe_data['Category'];
$Edit=$recipe_data['Edit'];
}
?>
<form name="update_recipe" method="post" action="edit.php">
<table border="0">
<input name="Edit" type="hidden" value="<?php echo $username; ?>" /></p>
<tr>
<td valign="top">Title</td>
<td><input type="text" name="Title" value="<?php echo $Title;?>" style="width: 250px"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td valign="top">Ingredients</td>
<td><textarea name="Ingredients" style="width: 500px; height: 150px"><?php echo $Ingredients;?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td valign="top">Method</td>
<td><textarea name="Method" style="width: 500px; height: 150px"><?php echo $Method;?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td valign="top">Category</td>
<td><textarea name="Category" style="width: 250px; height: 50px"><?php echo $Category;?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td><input type="hidden" name="RecipeID" value=<?php echo $_GET['RecipeID'];?>></td>
<td><input type="submit" name="update" value="Update"></td>
</tr>
</table>
</form>
|
Those are lines 116 thru 200.
I'm wondering if its an issue with the connection although, no errors appear to be showing in the logs other than a modify header one to redirect to the main index.php page, which ill deal with later.
Quote:
[31-May-2022 13:06:47 America/Chicago] PHP Warning: Cannot modify header information - headers already sent by (output started at /blah/blah/domain.com/home/manage/edit.php:12) in /blah/blah/domain.com/home/manage/edit.php on line 134
|