Upon submitting a form I want it to redirect to where it came from.
Using this: <a href="form_update.php?beer_id=<?php echo $row_beer_update['beer_id']; ?>">
I can create a link that will take me to the page I want with the right information. Unfortunately into won't work on the submit button. So I'd have to click once to submit the info, and again on the link to go to the page I want.
Using this:
mysql_select_db($database_beer_diary, $beer_diary);
$Result1 = mysql_query($updateSQL, $beer_diary) or die(mysql_error());
$row_beer_update = mysql_fetch_assoc($Result1);
$updateGoTo = "detail_sheet.php?recordID=";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
It will go to the page I want, but it doesn't have the information I want on it.
So trying to combine the two:
mysql_select_db($database_beer_diary, $beer_diary);
$Result1 = mysql_query($updateSQL, $beer_diary) or die(mysql_error());
$row_beer_update = mysql_fetch_assoc($Result1);
$updateGoTo = "detail_sheet.php?recordID=".echo $row_beer_update['beer_id'];
This is the closest I got (I've tried several variations, but none worked). On this attempt I keep on getting "parse eror" but I can't see what's missing.
Any ideas?
Thanks
Ah, bregent. I see what you are saying about the $Result1. So I tried this instead:
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
$updateSQL = sprintf("UPDATE beer SET beer_name=%s, brewer=%s, style_id=%s, substyle_id=%s, country_id=%s, location_id=%s, container_id=%s, aroma_id=%s, aroma_notes=%s, appearance_id=%s, appearance_notes=%s, mouthfeel_id=%s, mouthfeel_notes=%s, flavor_id=%s, flavor_notes=%s, overall_id=%s, overall_notes=%s, recommend=%s, abv=%s, date_tasted_01=%s, image_id=%s WHERE beer_id=%s",
GetSQLValueString($_POST['beer_id'], "int"));
mysql_select_db($database_beer_diary, $beer_diary);
$Result1 = mysql_query($updateSQL, $beer_diary) or die(mysql_error());
$updateGoTo = "detail_sheet.php?recordID=".echo $updateSQL['beer_id'];
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
But I am still getting the same parsing error.
North America
Europe, Middle East and Africa
Asia Pacific