[SOLVED]error message placing
Posted: Mon Aug 29, 2005 4:32 am
if i do this technique
then my form will be
the result of this is when the user supplied a blank character in the textbox, the error message will appear above the form, right?now, the deal is that, i want the error message to appear right after the textbox...can u guys help me modify the above code so i can attain this idea?thanks in advance.. 
Code: Select all
if (isset($_POST['submit']))
{
$message = NULL;
//check for project title
if (empty($_POST['projecttitle']))
{
$pt = false;
$message .= 'You forgot to enter the project title<br>';
}
else
{
$pt = $_POST['projecttitle'];
}
if ($pt)
{
//sql code goes here
}
}
if (isset($message))
{
echo '<font color=red>'.$message.'</font>';
}Code: Select all
<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" >
<input name="projecttitle" type="text" size="31" value="<? if (isset($_POST['projecttitle'])) echo $_POST['projecttitle']; ?>">
<input type="submit" name="submit" value="submit" class="buttonformat" />