Jump to content

validation problems


chrisuk

Recommended Posts

I am having trouble with checking multiple boxes to make sure they have been filled in:

 

i have tried both:

 

<?php
if (!isset($forename) || ($surname) || ($email)){
header("Location: adduser.php");
}
?>

 

and

 

<?php
if (empty($forename) || ($surname) || ($email)){
header("Location: adduser.php");
}
?>

 

to no avail.

 

I even tried seperate if statements...

 

basically if any one of the fields is filled in then it accepts the form, which is obviously not what I want!

 

What am i doing wrong?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/45700-validation-problems/
Share on other sites

this is odd - i realise my mistake but even with the above code, it will accept entry with blank fields

 

rather confused :S

 

i tried:

 

<?php

if (empty($forename) || empty($surname) || empty($email)){
   header("Location: adduser.php");
     }

?>

 

this works if nothing is filled in but if only one is filled in, it will accept!  ???

 

Link to comment
https://forums.phpfreaks.com/topic/45700-validation-problems/#findComment-222015
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.