Re: opening error messages in a new window

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/26/2012 4:41 AM, Dr Vijay Kumar wrote:
In filling a form, error messages should come in a new widow while
retaining the  form filled on the screen. Coding in php is required.

If I read your rather terse message correctly, you are looking for a way to provide error responses to the user without losing his/her input.

One way would be to add JS to your page, but you want it done with php. To do that all you have to do is be sure to capture all the input fields before beginning your editing and then to be sure to use those captured values (in their php vars) as the value clause of the html tags.

When you are receiving the POST data:
$fld1 = $_POST['fld1'];
$fld2 = $_POST['fld2'];
.
.
.
When you are editing use a var to hold your error message:
$errmsg = '';
if ($fld1 == '')
{
   $errmsg .= "You must enter a value for ....";
}
if ($fld2 > 0 && $fld2 < 10)
{
   $errmsg .= "You must enter a value between 1 and 9 for ....";
}
When you prepare the output page with tags:

echo $errmsg;
echo "<form.....>";
echo "<input type='text' name='fld1' value='$fld1'>";
echo "<input type='text' name='fld2' value='$fld2'>";
.
.
.

Hope this is what you are looking for, altho if you are already using php, you should already be doing this....


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux