Php mysql form field empty check

Hi,
I have this users profile page, where users can update their information.
What I've been trying to do is to get the username and phone number fields to check to see that they are not left empty, if left empty no update is done and the form shows an error message.

Here's the code:

<?php

if($_GET['success'] == 1 )
      {
            echo "<div style=\"font-weight: bold; color: #e80404; display: block; background-color: #ffffff; padding: 3px 3px 3px 3px; width: 190px;\">Profiilin muokkaus onnistui.</div>";
            echo "<br />";
      }
?>


<?php
//spostiosoitteen validointi
function validateemail($fieldname)
{
if(preg_match("/^[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*@([a-zA-Z0-9]*\.)+([a-zA-Z]{2,4})$/i",$fieldname))
          return TRUE; //jos validi spostiosoite palautetaan TRUE
     else
         return FALSE;
}

function getErrorMessages($aErrors)
{

    // This is where you can set an appropriate error message for different errors. Translate as you wish.

    $aErrorMessages = array();
    foreach ($aErrors as $sError) {
         switch ($sError) {
             case "EMPTY_FIELDS":
                  $aErrorMessages[] = "Et t&auml;ytt&auml;nyt kaikkia kentti&auml;, yrit&auml; uudelleen.";
                  break;
         }
    }
        return $aErrorMessages;
}

//Puhelinnumeron validointi toimii samalla tavalla kun spostivalidointi

function validatenro($fieldname) {
if(preg_match("/^[0-9\ ]+([0-9\-]{6,7})$/i",$fieldname))
             return TRUE;
     else
         return FALSE;
}

$color1 = '#f9f3e9';
$color2 = '#e3c795';

?>

<?php

$result=mysql_query("select * from users WHERE users_id = '".$_SESSION[users_id]."'");
?>
<?
// Fetch record rows in $result by while loop and put them into $row.
$datarow_count = 0;
while($row=mysql_fetch_assoc($result))
{
  $datarow_color = ($datarow_count % 2) ? $color1 : $color2;
  $datarow_count++;
?>

<form method="post" action="<?php echo $HTTP_POST_VARS['PHP_SELF']; ?>">
<input name="chk_<? echo $row['users_id']; ?>" type="hidden" id="chk_<? echo $row['users_id']; ?>" value="<? echo $row['users_id']; ?>"/>
<table style="border: 1px solid #e4900d;" cellpadding="2" cellspacing="0">
<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Etunimi:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><span style="width: 100px; color: #000000;"><? echo $row['fname']; ?></span></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Sukunimi:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><span style="width: 100px;  color: #000000;"><? echo $row['lname']; ?></span></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Tunnus:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input style="width: 100px;" class="formselect" name="username_<? echo $row['users_id']; ?>" type="text" id="username_<? echo $row['users_id']; ?>" value="<? echo $row['username']; ?>"/></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Taso:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><span style="width: 100px;  color: #000000;"><? echo $row['userlevel']; ?></span></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Salasana:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input style="width: 100px;" class="formselect" name="password_<? echo $row['users_id']; ?>" type="password" id="password_<? echo $row['users_id']; ?>" value=""/></td></tr>
<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">E-mail:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><input name="email_<? echo $row['users_id']; ?>" style="width: 150px;" class="formselect" type="text" id="email_<? echo $row['users_id']; ?>" value="<? echo $row['email']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Puhelinnumero:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input name="puh_<? echo $row['users_id']; ?>" style="width: 150px;" class="formselect" type="text" id="puh_<? echo $row['users_id']; ?>" value="<? echo $row['puhelinnumero']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Kotisivut:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><span style="color: #000000;">http://</span><input name="homepage_<? echo $row['users_id']; ?>" style="width: 150px;" class="formselect" type="text" id="homepage_<? echo $row['users_id']; ?>" value="<? echo $row['homepage']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Paikkakunta:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input name="address_<? echo $row['users_id']; ?>" style="width: 100px;" class="formselect" type="text" id="address_<? echo $row['users_id']; ?>" value="<? echo $row['address']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Story:</span></td><td style="border: 1px solid #e4900d;" width="250px" bgcolor= "<?php echo $color2;?>"><textarea name="bg_<? echo $row['users_id']; ?>" cols="26" style="font-size: 12px;" rows="5" id="bg_<? echo $row['users_id']; ?>"><? echo $row['bg']; ?></textarea>
</td> </tr>

<?
}

// End while loop.
?>
</table>
<input style="border: 2px solid #e4900d; border-style: outset;" id="redforms" type="submit" name="Submit" value="Muokkaa" />
</form>

<?php

if($_POST['Submit'])
{ // If receive Submit button variable.

// Select all data records in table "name_list" and put them into $result.

$result=mysql_query("select * from users order by users_id asc");

// Fetch record rows in $result by while loop and put them into $row.

while($row=mysql_fetch_assoc($result))
{

// Get the posted value "users_id" from form.php. This variable change its value by while loop.

if (isset($_POST["chk_".$row[users_id]]))
{
$username_=$_POST["username_".$row[users_id]];
$password_=$_POST["password_".$row[users_id]];
$email_=$_POST["email_".$row[users_id]];
$phone_=$_POST["puh_".$row[users_id]];
$homepage_=$_POST["homepage_".$row[users_id]];
$address_=$_POST["address_".$row[users_id]];
$bg_=$_POST["bg_".$row[users_id]];
$password_ = md5($password_);

// Update field "username", matching with "users_id" value by while loop.

if($_POST["password_".$row[users_id]] =="")
{
mysql_query("UPDATE users SET username='$username_', email='$email_', puhelinnumero='$puhelin_', homepage='$homepage_', address='$address_', bg='$bg_', regdate=regdate, show_email=show_email, last_login=last_login, userlevel=userlevel WHERE users_id='$row[users_id]'");
}
else
{
mysql_query("UPDATE users SET username='$username_', password='$password_', email='$email_', puhelinnumero='$puhelin_', homepage='$homepage_', address='$address_', bg='$bg_', regdate=regdate, show_email=show_email, last_login=last_login, userlevel=userlevel WHERE users_id='$row[users_id]'");
}

} // if (isset($_POST["chk_".$row[users_id]]))
} // while($row=mysql_fetch_assoc($result))

$goback = "index.php?id=content&page=main&success=1";
echo ('<meta http-equiv="refresh" content="0.1;url= '.$goback.' ">');

} // if($_POST['Submit'])

?>
</div>

I've tried using this function:
function getErrorMessages($aErrors)

and doing a :

$aErrors = array();     // Array that keeps track of errors

     // Check if values are not empty

     if ($username_ == "" || $phone_ == "")
         {
             $aErrors[] = "EMPTY_FIELDS";
         }

but this is not working, this works on all my other forms but not here.. could it have something to do with the while loop?

Thanks in advance.

-T

ToubeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ToubeAuthor Commented:
Anyone?
0
netmunkyCommented:
but where is the function getErrorMessages called? i don't see it anywhere before processing the POST data

try changing:
if($_POST['Submit'])
to:
if( $_POST['Submit'] && $_POST["username_".$row[users_id]] && $_POST["username_".$row[users_id]] != '' && $_POST["puh_".$row[users_id]] && $_POST["puh_".$row[users_id]] != '' )
0
ToubeAuthor Commented:
The function looks the following way and it's located at the top of the first post:

function getErrorMessages($aErrors)
{

    // This is where you can set an appropriate error message for different errors. Translate as you wish.

    $aErrorMessages = array();
    foreach ($aErrors as $sError) {
         switch ($sError) {
             case "EMPTY_FIELDS":
                  $aErrorMessages[] = "Et t&auml;ytt&auml;nyt kaikkia kentti&auml;, yrit&auml; uudelleen.";
                  break;
         }
    }
        return $aErrorMessages;
}

And tried your suggestion, but didn't work?

-T
0
OWASP: Threats Fundamentals

Learn the top ten threats that are present in modern web-application development and how to protect your business from them.

netmunkyCommented:
i know where the function is defined, but the function is never used in the code that you posted

sorry, $row doesn't exist yet at if($_POST['Submit'])

instead, alter this line:
if (isset($_POST["chk_".$row[users_id]]))
to
if ( isset($_POST["chk_".$row[users_id]]) && isset($_POST["username_".$row[users_id]]) && $_POST["username_".$row[users_id]] != '' && isset($_POST["puh_".$row[users_id]]) && $_POST["puh_".$row[users_id]] != '' )
0
ToubeAuthor Commented:
Hi, sorry for the answer delay, so you mean the function is never used,  this is how I have setup it up at the moment.. but the function is not working here:

<?php
//spostiosoitteen validointi
function validateemail($fieldname)
{
if(preg_match("/^[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*@([a-zA-Z0-9]*\.)+([a-zA-Z]{2,4})$/i",$fieldname))
          return TRUE; //jos validi spostiosoite palautetaan TRUE
     else
         return FALSE;
}

function getErrorMessages($aErrors)
{

    // This is where you can set an appropriate error message for different errors. Translate as you wish.

    $aErrorMessages = array();
    foreach ($aErrors as $sError) {
         switch ($sError) {
             case "EMPTY_FIELDS":
                  $aErrorMessages[] = "Et t&auml;ytt&auml;nyt kaikkia kentti&auml;, yrit&auml; uudelleen.";
                  break;
         }
    }
        return $aErrorMessages;
}

//Puhelinnumeron validointi toimii samalla tavalla kun spostivalidointi

function validatenro($fieldname) {
if(preg_match("/^[0-9\ ]+([0-9\-]{6,7})$/i",$fieldname))
             return TRUE;
     else
         return FALSE;
}

$color1 = '#f9f3e9';
$color2 = '#e3c795';

?>

<?php

$result=mysql_query("select * from users WHERE users_id = '".$_SESSION[users_id]."'");
?>
<?
// Fetch record rows in $result by while loop and put them into $row.
$datarow_count = 0;
while($row=mysql_fetch_assoc($result))
{
  $datarow_color = ($datarow_count % 2) ? $color1 : $color2;
  $datarow_count++;
?>

<?php

if(isset($_POST['Submit']))
{ // If receive Submit button variable.

// Select all data records in table "name_list" and put them into $result.

$result=mysql_query("select * from users order by users_id asc");

// Fetch record rows in $result by while loop and put them into $row.

while($row=mysql_fetch_assoc($result))
{

// Get the posted value "users_id" from form.php. This variable change its value by while loop.

if (isset($_POST["chk_".$row[users_id]]))
{
$username_=$_POST["username_".$row[users_id]];
$password_=$_POST["password_".$row[users_id]];
$email_=$_POST["email_".$row[users_id]];
$puhelin_=$_POST["puh_".$row[users_id]];
$homepage_=$_POST["homepage_".$row[users_id]];
$address_=$_POST["address_".$row[users_id]];
$rows_=$_POST["rowspage_".$row[users_id]];
$bg_=$_POST["bg_".$row[users_id]];
$password_ = md5($password_);

 $aErrors = array();

// Update field "username", matching with "users_id" value by while loop.

if ($username_ == "" || $email_ == "")
         {
           $aErrors[] = "EMPTY_FIELDS";
       }
if (count($aErrors) == 0) {

if($_POST["password_".$row[users_id]] =="")
{
mysql_query("UPDATE users SET username='$username_', email='$email_', puhelinnumero='$puhelin_', homepage='$homepage_', address='$address_', amount='$rows_', bg='$bg_', regdate=regdate, show_email=show_email, last_login=last_login, userlevel=userlevel WHERE users_id='$row[users_id]'");
}
if($_POST["password_".$row[users_id]] !="")
{
mysql_query("UPDATE users SET username='$username_', password='$password_', email='$email_', puhelinnumero='$puhelin_', homepage='$homepage_', address='$address_', amount='$rows_', bg='$bg_', regdate=regdate, show_email=show_email, last_login=last_login, userlevel=userlevel WHERE users_id='$row[users_id]'");
}
else
     {

              $aErrorMessages = getErrorMessages($aErrors);
              echo ('<div style="font-weight: bold; color: #691717;">');
              echo ('Virheit&auml; rekister&ouml;inniss&auml;:<br/>');
              echo ('<br/>');
              foreach($aErrorMessages as $sError) {
                   echo ('<li>' . $sError);
              }
              echo ('</div>');

     }
} // if (isset($_POST["chk_".$row[users_id]]))
} // while($row=mysql_fetch_assoc($result))

$goback = "index.php?id=content&page=main&success=1";
echo ('<meta http-equiv="refresh" content="0.1;url= '.$goback.' ">');

} // if($_POST['Submit'])

}
?>

Regards,

-T
0
ToubeAuthor Commented:
Ok, got it working now.. but I still can't get the emailvalidation to work.. any ideas?

Here's the code:

<?php
//spostiosoitteen validointi
function validateemail($fieldname)
{
if(preg_match("/^[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*@([a-zA-Z0-9]*\.)+([a-zA-Z]{2,4})$/i",$fieldname))
          return TRUE; //jos validi spostiosoite palautetaan TRUE
     else
         return FALSE;
}

function getErrorMessages($aErrors)
{

    // This is where you can set an appropriate error message for different errors. Translate as you wish.

    $aErrorMessages = array();
    foreach ($aErrors as $sError) {
         switch ($sError) {
             case "EMPTY_FIELDS":
                  $aErrorMessages[] = "Tunnus ja E-mail kenttä oltava täytettynä";
                  break;
         }
    }
        return $aErrorMessages;
}

//Puhelinnumeron validointi toimii samalla tavalla kun spostivalidointi

function validatenro($fieldname) {
if(preg_match("/^[0-9\ ]+([0-9\-]{6,7})$/i",$fieldname))
             return TRUE;
     else
         return FALSE;
}

$color1 = '#f9f3e9';
$color2 = '#e3c795';

?>

<?php

if(isset($_POST['Submit']))
{ // If receive Submit button variable.

// Select all data records in table "name_list" and put them into $result.

$result=mysql_query("select * from users order by users_id asc");

// Fetch record rows in $result by while loop and put them into $row.

while($row=mysql_fetch_assoc($result))
{

// Get the posted value "users_id" from form.php. This variable change its value by while loop.

if (isset($_POST["chk_".$row[users_id]]))
{
$username_=$_POST["username_".$row[users_id]];
$password_=$_POST["password_".$row[users_id]];
$email_=$_POST["email_".$row[users_id]];
$puhelin_=$_POST["puh_".$row[users_id]];
$homepage_=$_POST["homepage_".$row[users_id]];
$address_=$_POST["address_".$row[users_id]];
$rows_=$_POST["rowspage_".$row[users_id]];
$bg_=$_POST["bg_".$row[users_id]];
$password_ = md5($password_);

 $aErrors = array();

// Update field "username", matching with "users_id" value by while loop.

if ($username_ == "" || $email_ == "")
{
  $aErrors[] = "EMPTY_FIELDS";
}
if (count($aErrors) == 0) {

if($_POST["password_".$row[users_id]] =="")
{
mysql_query("UPDATE users SET username='$username_', email='$email_', puhelinnumero='$puhelin_', homepage='$homepage_', address='$address_', amount='$rows_', bg='$bg_', regdate=regdate, show_email=show_email, last_login=last_login, userlevel=userlevel WHERE users_id='$row[users_id]'");
}
else
{
mysql_query("UPDATE users SET username='$username_', password='$password_', email='$email_', puhelinnumero='$puhelin_', homepage='$homepage_', address='$address_', amount='$rows_', bg='$bg_', regdate=regdate, show_email=show_email, last_login=last_login, userlevel=userlevel WHERE users_id='$row[users_id]'");
}
$goback = "index.php?id=content&page=main&success=1";
echo ('<meta http-equiv="refresh" content="0.1;url= '.$goback.' ">');
}
else
     {

              $aErrorMessages = getErrorMessages($aErrors);
              echo ('<div style="font-weight: bold; color: #ffffff;">');
              echo ('Kenttä tyhjä, täytä kenttä:<br/>');
              echo ('<br/>');
              foreach($aErrorMessages as $sError) {
                   echo ('<li>' . $sError);
              }
              echo ('</div>');

     }


} // if (isset($_POST["chk_".$row[users_id]]))
} // while($row=mysql_fetch_assoc($result))



} // if($_POST['Submit'])


?>

<?php

$result=mysql_query("select * from users WHERE users_id = '".$_SESSION[users_id]."'");
?>
<?
// Fetch record rows in $result by while loop and put them into $row.
$datarow_count = 0;
while($row=mysql_fetch_assoc($result))
{
  $datarow_color = ($datarow_count % 2) ? $color1 : $color2;
  $datarow_count++;
?>


<form method="post" action="<?php echo $HTTP_POST_VARS['PHP_SELF']; ?>">
<input name="chk_<? echo $row['users_id']; ?>" type="hidden" id="chk_<? echo $row['users_id']; ?>" value="<? echo $row['users_id']; ?>"/>
<table style="border: 1px solid #e4900d;" cellpadding="2" cellspacing="0">
<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Etunimi:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><span style="width: 100px; color: #000000;"><? echo $row['fname']; ?></span></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Sukunimi:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><span style="width: 100px;  color: #000000;"><? echo $row['lname']; ?></span></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Tunnus:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>">
<?php

if(($username_) != null || !isset($_POST['Submit']))

     {
                  echo ('<input id="formselect" type="text" name="'.username_ .$row['users_id'].'" value="'.$row['username'].'" />');
      }

else
{

       echo ('<input type="text" class="error" name="'.username_ .$row['users_id'].'" value="'.$row['username'].'" />');
       echo ('<span style="font-weight: bold; color: #691717;">&nbsp;*t&auml;yt&auml; kentt&auml;!</span>');
}

?>
<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Taso:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><span style="width: 100px;  color: #000000;"><? echo $row['userlevel']; ?></span></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Salasana:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input style="width: 100px;" class="formselect" name="password_<? echo $row['users_id']; ?>" type="password" id="password_<? echo $row['users_id']; ?>" value=""/></td></tr>
<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">E-mail:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>">
<?php

if(($email_) != null || !isset($_POST['Submit']))

     {
           if($email_notvalid)

          echo ('<input style="width: 100px;" type="text" class="error" name="'.email_ .$row['users_id'].'" value="'.$row['email'].'" /><span style="font-weight: bold; color: #691717;">&nbsp;*ei validi s&auml;hk&ouml;postiosoite</span>');

            else
            {
                  echo ('<input id="formselect" type="text" name="'.email_ .$row['users_id'].'" value="'.$row['email'].'" />');
            }
     }

else
{

       echo ('<input type="text" class="error" name="'.email_ .$row['users_id'].'" value="'.$row['email'].'" />');
       echo ('<span style="font-weight: bold; color: #691717;">&nbsp;*t&auml;yt&auml; kentt&auml;!</span>');
}

?>

</td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Puhelinnumero:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input name="puh_<? echo $row['users_id']; ?>" style="width: 150px;" class="formselect" type="text" id="puh_<? echo $row['users_id']; ?>" value="<? echo $row['puhelinnumero']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Kotisivut:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color2;?>"><span style="color: #000000;">http://</span><input name="homepage_<? echo $row['users_id']; ?>" style="width: 150px;" class="formselect" type="text" id="homepage_<? echo $row['users_id']; ?>" value="<? echo $row['homepage']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Paikkakunta:</span></td><td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>"><input name="address_<? echo $row['users_id']; ?>" style="width: 100px;" class="formselect" type="text" id="address_<? echo $row['users_id']; ?>" value="<? echo $row['address']; ?>"/></td> </tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Viestejä/sivu(foorumissa):</span></td>
<td style="border: 1px solid #e4900d;" bgcolor= "<?php echo $color1;?>">
<select class="formselect1" name="rowspage_<? echo $row['users_id']; ?>" id="rowspage_<? echo $row['users_id']; ?>">
<option value="10">10</option><option value="20" selected="selected">20</option><option value="30">30</option><option value="40">40</option><option value="50">50</option><option value="60">60</option><option value="70">70</option><option value="80">80</option><option value="90">90</option><option value="100">100</option></select></td></tr>

<tr>
<td style="border: 1px solid #e4900d;" align="left" bgcolor="#831009"><span style="color: #ffffff;">Story:</span></td><td style="border: 1px solid #e4900d;" width="250px" bgcolor= "<?php echo $color2;?>"><textarea name="bg_<? echo $row['users_id']; ?>" cols="26" style="font-size: 12px;" rows="5" id="bg_<? echo $row['users_id']; ?>"><? echo $row['bg']; ?></textarea>
</td> </tr>

<?
}

// End while loop.
?>
</table>
<input style="border: 2px solid #e4900d; border-style: outset;" id="redforms" type="submit" name="Submit" value="Muokkaa" />
</form>

</div>


-T
0
netmunkyCommented:
it's the same thing

all i see you do is define the validateemail function without ever actually calling it

you need something like
if( ! validateemail( $email ) )
{
  // print error
}
else
{
  // do stuff
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.