Some help would be great here.
The following snippets work, but I am unable to figure out how to activate the error message "You did not select a name for editing".
Both of the other error codes work but if I input 'given' and 'family' and forget to select the relevant radio button, the error message doesn't work.
No other problems with the code.

// Query member data from the database
$query1 = mysql_query("SELECT userId FROM users WHERE managerId='".$recid."' AND userGroup='".$group2."' ORDER BY userId ASC");
while($row1 = mysql_fetch_array($query1))
$firstGroup .=$row1['userId']. ' <input type="radio" name="snames" value="'.$row1['userId'].'" /> ' . "&nbsp;&nbsp;&nbsp;&nbsp;<br /><br>";
  <form method="post" enctype="multipart/form-data" action="<?PHP echo $_SERVER["PHP_SELF"]; ?>">
      <td><?php echo $firstGroup;?></td>
      <td><input type="text" name="given" value="" /><p>
          <input type="text" name="family" value="" /><p>
          <input type="submit" value="submit" name="Send Data"></form></td> 

Here are the error messages and their activation method.

// Process the form if it is submitted
if ($_POST['snames']) {
	$snames = $_POST['snames'];
	$family = preg_replace("/[^A-Za-z0-9]/", ".", $_POST['family']);
	$given  = preg_replace("/[^A-Za-z0-9]/", ".", $_POST['given']);
	//next section deals with error messaging
	$errorMsg = "ERROR:";			
			if(!$snames) {
    		$errorMsg .= "--- You did not select a name for editing.";
			else if(!$family)	
			$errorMsg .= "--- You did not enter a family name.";
			else if(!$given) 
			$errorMsg .= "--- You did not enter a given name.";

}// close if post
echo $errorMsg;
6 Years
Discussion Span
Last Post by whiteyoh

why dont you try having the messages present, but set to display none in css. if something fails you could the change the css to display block.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.