Jump to content

help with error display


Jay2391

Recommended Posts

So I have this form that i wanted to align and look good right to imput registration information....

 

so what I did.... I put the form in a table and i wanted to be sticky because i have to verify for errors before sending to the table..

 

the issue i have is that the error mesage will only come up under the submit button.... I want errors to show at the top or in the side of each text field... check the code .

 

 

 

<?php

ini_set ('display_error',1);
  error_reporting (E_ALL & ~E_NOTICE);
  define ('Title', 'Register');
print '<style type="text/css">
     <!-- .style10 {font-size: 20px; font-family: Verdana;} --> </style>'; 
  
print '<p><div align="left" class="style10"><font color="blue">Registration Form</font></div></p>';
print '<form action="md_reg.php" method="post">';

echo " $error_name ";


print
    '<style type="text/css">
     <!-- .style9 {font-size: 9px; font-family: Verdana;} --> </style> 

 <style type="text/css">
     <!-- .style7 {font-size: 10px; font-family: Verdana;} --> </style>

    <table width="400" border="0" cellspacing="0" cellpadding="0"><tr>

    <th width="80" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9">ID:</div></th>
    <td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">
<div align="left" class="style9"><input type="text" name="id"
size"100" value="' . $_POST['id'] . '"/></div></td>
<td width="200" height="12" align="center" valign="middle" nowrap="nowrap" scope="col">

              [color=red][font=Verdana]//////error should be here!!!![/font][/color]

</td>
    </tr>

print '<br><input type="submit" name="submit" size"20" value="Register!!"/><br /></h4>';

    if ( isset ($_POST['submit'])){
   $problem = FALSE;
   
   if (empty ($_POST['id'])){
	  $problem = TRUE;
	  $error_id = '<div align="left" class="style9"><font color="red">Please create a "User Name"</div>';	
	  echo "$error_id";		  
   }
    }

?>

Link to comment
https://forums.phpfreaks.com/topic/70786-help-with-error-display/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.