need hel

I have a php update script running thats grabbing information from 5 fields… 4 of which are dropdowns… IM trying to make an if statment of some sort to ensure one of the four drop downs has a certain selection or it gives an error…

any help?

started by doing this but all it does is sets the value to what is shown

if ($_POST[‘sessiona’] = “121”){

Update heres what i have now:

if ($_POST[‘sessiona’] == “121” OR $_POST[‘sessionb’] == “221” OR $_POST[‘sessionc’] == “321” OR $_POST[‘sessiond’] == “421”){
if ((isset($_POST[“MM_update”])) && ($_POST[“MM_update”] == “form1”)) {
$updateSQL = sprintf(“UPDATE users SET tshirt=%s, sessiona=%s, sessionb=%s, sessionc=%s, sessiond=%s WHERE idusers=%s”,
GetSQLValueString($_POST[‘Tshirt2’], “text”),
GetSQLValueString($_POST[‘sessiona’], “text”),
GetSQLValueString($_POST[‘sessionb’], “text”),
GetSQLValueString($_POST[‘sessionc’], “text”),
GetSQLValueString($_POST[‘sessiond’], “text”),
GetSQLValueString($_POST[‘idusers’], “text”));

mysql_select_db($database_wellness, $wellness);
$Result1 = mysql_query($updateSQL, $wellness) or die(mysql_error());

$updateGoTo = “schedule.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$updateGoTo .= (strpos($updateGoTo, ‘?’)) ? “&” : “?”;
$updateGoTo .= $_SERVER[‘QUERY_STRING’];

now it works … but if i set it to the proper thing in one of the fields it updates fields with default values not ones they choose.

You’re declaring your values for the SQL query to be string values, but you’re not using quotes around them. Try doing something like this:

$sqlquery = "UPDATE table SET field1 = '"$somevalue1"', field2 = '".$somevalue2."' WHERE condition1 = '".$somecondition."'";
Sponsor our Newsletter | Privacy Policy | Terms of Service