As i cudn't post in my old thread, cos vBull**** suckzors big time lol, im making this thread for help:
kk ive got this code:
PHP Code:
<?php
if($_POST['submit']{
$formid = $_POST['submitdownloads'] //standard variables are easier to work with
if(isset($_COOKIE[$formid]){
if($_COOKIE[$formid] >= 2){
echo("Thanks for submitting your downloads, you have now reached the limit");
} else {
$_COOKIE[$formid] += 1;
echo("Submitting data...");
} else {
setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds
}
}
?>
and im getting this error:
Code:
Parse error: syntax error, unexpected T_IF in /home/chris2009/xtremeddl.net/submit.php on line 90
Im tryna make da form initialy, per session be able to be submitted 5x....
$formid = $_POST['submitdownloads']; //standard variables are easier to work with if(isset($_COOKIE[$formid]){ if($_COOKIE[$formid] >= 2){ echo("Thanks for submitting your downloads, you have now reached the limit"); } else { $_COOKIE[$formid] += 1; echo("Submitting data..."); } else { setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds } } ?>
now got this error:
Code:
Parse error: syntax error, unexpected ';' in /home/chris2009/xtremeddl.net/submit.php on line 89
Edit: here's my whole form:
PHP Code:
<form action="" method="post">
<?php if($_POST['submit']{
$formid = $_POST['submitdownloads']; //standard variables are easier to work with if(isset($_COOKIE[$formid]){ if($_COOKIE[$formid] >= 2){ echo("Thanks for submitting your downloads, you have now reached the limit"); } else { $_COOKIE[$formid] += 1; echo("Submitting data..."); } else { setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds } } ?>
You are also missing a ) after your first if statement. "if($_POST['submit']){"
Just work on weeding out all instances that are missing characters. That should be it, but if you get any more errors, go to the line that the error is on and it shouldn't be too hard to find what's wrong.
EDIT: A few more errors
1. "if(isset($_COOKIE[$formid])){ "
2. echo "Thanks for submitting your downloads, you have now reached the limit" ; //echoed statements do not need to be surrounded in ()
Don't use if (isset($_POST['submit'])) because internet explorer has a but and doesn't always send the submit button value. You should test for other data in the form instead.
Also can I perhaps interest you in the 2nd link in my signature? - You might find it useful for the future
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
$formid = $_POST['submitdownloads']; //standard variables are easier to work with if(isset($_COOKIE[$formid]) { if($_COOKIE[$formid]) >= 2){ echo "Thanks for submitting your downloads, you have now reached the limit"; } else { $_COOKIE[$formid] += 1; echo "Submitting data..."; } else { setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds } } ?>
now got:
Code:
Parse error: syntax error, unexpected '{' in /home/chris2009/xtremeddl.net/submit.php on line 91
Refer to my last post. if(isset($_COOKIE[$formid]) is still missing a ). You have two opening parenthesis (one before isset and one before $_COOKIE) and only one ending parenthesis.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
$formid = $_POST['submitdownloads']; //standard variables are easier to work with if(isset($_COOKIE[$formid])) { if($_COOKIE[$formid]) >= 2 { echo "Thanks for submitting your downloads, you have now reached the limit"; } else { $_COOKIE[$formid] += 1; echo "Submitting data..."; } else { setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds } } ?>
now im getting:
Code:
Parse error: syntax error, unexpected T_IS_GREATER_OR_EQUAL in /home/chris2009/xtremeddl.net/submit.php on line 91
i dunno what this means, help?
As you might guess, I'm definitely not an avid PHPer :-)
Thanks for your help so far! I hope we can get this working!
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
$formid = $_POST['submitdownloads']; //standard variables are easier to work with if(isset($_COOKIE[$formid])) { if($_COOKIE[$formid] >= 2) { echo "Thanks for submitting your downloads, you have now reached the limit"; } else { $_COOKIE[$formid] += 1; echo "Submitting data..."; } else { setcookie($formid, 1, 86400); //name formid, value 1, expires in 86400 seconds } } ?>
error:
Code:
Parse error: syntax error, unexpected T_ELSE in /home/chris2009/xtremeddl.net/submit.php on line 96
Along with having 2 else's, you also have a { too many. For the else problem you have two options: elseif or switch().
I've already recommended you take a look at the second link in my signature about coding styles. You chose to ignore that so i won't be assisting you to find the additional { as apparently you are above my help.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.