?
Solved

Php mysql form field empty check

Posted on 2007-03-17
7
Medium Priority
?
524 Views
Last Modified: 2013-12-13
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

0
Comment
Question by:Toube
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 

Author Comment

by:Toube
ID: 18743396
Anyone?
0
 
LVL 8

Expert Comment

by:netmunky
ID: 18749468
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
 

Author Comment

by:Toube
ID: 18750689
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
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
LVL 8

Expert Comment

by:netmunky
ID: 18751121
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
 

Author Comment

by:Toube
ID: 18769601
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
 

Author Comment

by:Toube
ID: 18769941
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
 
LVL 8

Accepted Solution

by:
netmunky earned 1800 total points
ID: 18770948
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

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question