Hello
I have a problem running this code on my V5 form. I had to regenerate this code as I had lost this code. Would someone please pinpoint the fault.
I am trying to make the radio button "required" but I am not able to make it work. The code is below.
Thanks for any possible help.
Ronn
I have a problem running this code on my V5 form. I had to regenerate this code as I had lost this code. Would someone please pinpoint the fault.
I am trying to make the radio button "required" but I am not able to make it work. The code is below.
$available_options = array("exw"=>"<font color='RED'><b>1.</b></font><b>Ex-Works.(EXW)<b/><font color='RED'> ==> </font> ",
"fob"=>"<font color='RED'><b>2.</b></font><b>Free on Board.(FOB)<b/><font color='RED'> ==> </font>",
"cfr"=>"<font color='RED'><b>3.</b></font><b>Cost and Freight.(CFR)<b/><font color='RED'> ==> </font>",
"cif"=>"<font color='RED'><b>4.</b></font><b>Cost Insurance Freight.(CIF)<b/><font color='RED'> ==> </font>",
"other"=>"<font color='RED'><b>5.</b></font><b>Other mode<b/><font color='RED'> ==> </font>",
);
if ($_GET["cref"]=="exw") echo "checked=\"checked\"";
if ($_GET["cref"]=="fob") echo "checked=\"checked\"";
if ($_GET["cref"]=="cfr") echo "checked=\"checked\"";
if ($_GET["cref"]=="cif") echo "checked=\"checked\"";
if ($_GET["cref"]=="other") echo "checked=\"checked\"";
if (strlen($processing_message) > 0) {
echo '<div class="processing_message">'.$processing_message.'</div>';
}
echo '<form method="post" action="'.basename(__file__).'">';
foreach($available_options as $option_value=>$option_label) {
//Notice the use of the ternary operator ()?: to check the selected radio button after the form was submitted.
echo $option_label.'<input type="radio" style="font-family:Verdana, Geneva, sans-serif; font-size:15px; border:1px solid #999;" name="option_choice" required value="'.$option_value.'" '.(($option_value == $_POST['option_choice'])?' checked="checked"':'').'/><br><br>';
if (empty($_GET) === false) {
$available_options = array('exw', 'fob', 'cfr', 'cif');
foreach ($_GET as $key=>$value) {
if (empty($value) && in_array($key, $available_options) === true) {
$errors[] = 'You didn\'t select the type of price quote.';
break 1;
}
}
}
print_r($errors);
}
echo '<input type="submit" class="submitbtn" value="Proceed" style="font-family:Verdana, Geneva, sans-serif; width:180px; height:40px; font-size:20px;" />';
echo '</form>';
Thanks for any possible help.
Ronn