Thanks Bob,
That was helpful. It didn't quite get there, but am posting my solution for others' reference.
It seemed to work for something like :
<?php
if ($posted['radio0'] ="I am a Registered Medical Practitioner") {
echo "I do not require Environmental Health Licensing because I am a Registered Medical Practitioner";}
} else {
echo "I require Environmental Health Licensing.";
}
?>
However, when i add a third condition something like:
<?php
if ($posted['radio0'] ="I am a Registered Medical Practitioner") {
echo "I do not require Environmental Health Licensing because I am a Registered Medical Practitioner";}
else if ($posted['radio0'] ="I am a Dentist") {
echo "I do not require Environmental Health Licensing because I am a Dentist";
} else {
echo "I require Environmental Health Licensing.";
}
?>
or
<?php
$myradio0=$posted['radio0'];
switch ($myradio0) {
case ("I am a Registered Medical Practitioner"):
echo "I am a Registered Medical Practitioner";
break;
case ("I am a Dentist"):
echo "I am a Dentist";
break;
case (""):
echo "I require Environmental Health Licensing";
break;
}
?>
it doesn't add the third condition. In fact when i look deeper, i'm not sure if this method works, since if I try
<?php
echo $posted['radio0'];
?>
nothing is printed out.
So I went for a database lookup for the last post based on cf_id
<?php
$q = mysql_query("SELECT radio0 FROM jos_chronoforms_xxx WHERE cf_id= (SELECT MAX(cf_id) from jos_chronoforms_full_p5)") or die(mysql_error());
// store the record of the "example" table into $row
$row = mysql_fetch_array( $q );
// Print out the contents of the entry
$myradio0=$row['radio0'];
switch ($myradio0) {
case ("I am a Registered Medical Practitioner"):
echo "I do not require Environmental Health Licensing because I am a Registered Medical Practitioner";
break;
case ("I am a Dentist"):
echo "I do not require Environmental Health Licensing because I am a Dentist";
break;
default:
echo "I require Environmental Health Licensing";
break;
}
?>
?>
Which is now working. I suppose i'd be curious of ideas about preventing the wrong information being retrieved if two people were (more or less) simultaneously filling out a form.
many thanks,
Gavin