خرید بک لینک
I'm testing error messages for form submission. I have this code
PHP Code:

$err=0;
$msgName="*";
$errName=0;
$msgMissing="Fill in all fields marked *";
$errMissing=0;
if(isset(
$_POST['Submit']))
{
    if(isset(
$_POST['Name']))
    {
        echo 
"0";
        
filter_var(trim($_POST['Name']),FILTER_SANITIZE_STRING);
    }
    else
    {
        echo 
"1";
        
$errName++;
        
$err++;
    }
        
        if(
$err == 0)
    {
        echo 
"submit";
    }
    elseif(
$err 0)
    {
        
        
$errMissing 1;
        
    }


In my form I have have a div that displays
PHP Code:

if($errMissing 0){echo $msgMissing;} 

and another that displays
PHP Code:

if($errName 0){echo $msgName;} 

When I submit an empty for form, the page displays 0submit, which shouldn't be possible. Any help appreciated.

برچسب: نویسنده: آیلین رضوانی تاريخ: چهارشنبه 20 دی 1396 ساعت: 7:09

صفحه بندی