Tuesday, May 8, 2012

PHP - Insert values from radio button values into mysql


$email=$_POST['email_id'];
 $option=$_POST['optn'];

 // Insert value from radio button value into mysql
while($ib_row = mysql_fetch_array($row))
{
  echo $email;
echo "</br>";
echo $option;
echo "</br>";

switch($option)
{
case "option1":
$answer_submit =  $ib_row['option1'];
echo $answer_submit;
break;
case "option2":
$answer_submit =  $ib_row['option2'];
echo $answer_submit;
break;
  case "option3":
$answer_submit =  $ib_row['option3'];
echo $answer_submit;
break;
case "option4":
$answer_submit =  $ib_row['option4'];
echo $answer_submit;
break;
}

$quiz_id = $ib_row['quizid'];
}

 mysql_query("INSERT INTO quiz_response_lcd VALUES ('$quiz_id', '$email', '$answer_submit', CURDATE())");

No comments:

Post a Comment