- Impact
- 11
Im trying to get this code to work. This is a checkout im working on for my site, the user selects a package and types in how much of those packages they want. If they type '1' it shows just the text boxes for 1. But if they choose '5' it shows those text boxes 5 times.
IE:
I choose '3' for the quantity. It will show:
#1
Site Name:
Site Url:
Etc:
Etc:
#2
Site Name:
Site Url:
Etc:
Etc:
#3
Site Name:
Site Url:
Etc:
Etc:
but the code i have will check #1, if all fields are present, it accepts it. Then it checks #2, if a field is present, it rejects it. Then #3 if all fields are present, it accepts it.
I want it to reject ALL (ie #1 and #2 have all the fields present, but #3 is missing a field, then it rejects them all)
IE:
I choose '3' for the quantity. It will show:
#1
Site Name:
Site Url:
Etc:
Etc:
#2
Site Name:
Site Url:
Etc:
Etc:
#3
Site Name:
Site Url:
Etc:
Etc:
but the code i have will check #1, if all fields are present, it accepts it. Then it checks #2, if a field is present, it rejects it. Then #3 if all fields are present, it accepts it.
I want it to reject ALL (ie #1 and #2 have all the fields present, but #3 is missing a field, then it rejects them all)
PHP:
<?
$qty = $_POST['qnty'];
$total = $_POST['cost'];
$name = $_POST['name'];
$ppemail = $_POST['email'];
$pkg = $_POST['package'];
while($n < $qty){
$sn= $n + 1;
$sname = $_POST['sname'.$sn.''];
$surl = $_POST['surl'.$sn.''];
$stags = $_POST['stags'.$sn.''];
$scat = $_POST['scategory'.$sn.''];
$sdesc = $_POST['sdescription'.$sn.''];
if(($name == "")||($ppemail == "")||($sname == "")||($surl == "")||($stags == "")||($scat == "")||($sdesc == ""))
{
$n++;
echo'You forgot something, go back!';
}else{
$n++;
echo'Accepted';
}
}
?>







