Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 35
  1. #1
    Regular Coder
    Join Date
    May 2011
    Posts
    303
    Thanks
    29
    Thanked 0 Times in 0 Posts

    Limit Form Submission P2

    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($formid186400); //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....

    any help?

  • #2
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    http://www.rosettastone.com/spring5p...FRNrgwodvW7LTg

    Oh, and there's no ; after your $formid line.
    "Yeah science!"
    Online Science Tools

  • #3
    Regular Coder
    Join Date
    May 2011
    Posts
    303
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Sorry about the language...

    Fixed the ; here:
    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($formid186400); //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($formid186400); //name formid, value 1, expires in 86400 seconds
        

    }
    ?>


            <?php
            
    for($i=1;$i<=10;$i++) {
            
    ?>

            <div>
            <input type="text" class="inputbox" name="title[]" id="dt1" cols="80" />
            <input type="text" class="inputbox" name="url[]" id="du1" />
            <select name="type[]" class="inputbox smallbox" id="se1">
            <?php
            
    foreach($core->allowed_types as $at) {
            echo 
    '<option value="'.$at.'">'.$at.'</option>';
            }
            
    ?>
            </select></div>
            <?php
            
    }
            
    ?>

            <div>Site Name: <input type="text" class="inputbox" name="sname" id="zname"/>
            Site URL: <input type="text" class="inputbox" name="surl" id="zurl"/><br />
            Email: <input type="text" class="inputbox" name="email" id="zemail"/>
            <input type="submit" value="Submit Downloads" /></div>

            <div><?=$core->error?>
            <br /><?=$sub_success?></div>
            </form>
    do u have msn to chat?
    Last edited by Chris-2k; 05-22-2011 at 11:19 PM.

  • #4
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    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 ()
    Last edited by djh101; 05-22-2011 at 11:53 PM.
    "Yeah science!"
    Online Science Tools

  • Users who have thanked djh101 for this post:

    Chris-2k (05-23-2011)

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,345
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    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
    Last edited by tangoforce; 05-23-2011 at 12:16 AM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #6
    Regular Coder
    Join Date
    May 2011
    Posts
    303
    Thanks
    29
    Thanked 0 Times in 0 Posts
    corrected all errors now,

    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($formid186400); //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

  • #7
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    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.
    "Yeah science!"
    Online Science Tools

  • #8
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,345
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    There is also one closing parenthesis too many on this line - 2 closing and 1 opening:

    if($_COOKIE[$formid]) >= 2){
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #9
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    Ah yes, you added the ) after the wrong $_COOKIE[$formid].
    "Yeah science!"
    Online Science Tools

  • #10
    Regular Coder
    Join Date
    May 2011
    Posts
    303
    Thanks
    29
    Thanked 0 Times in 0 Posts
    hi,

    fixed:

    PHP Code:
    <?php
    if($_POST['submit']){ 
              
              
    $formid $_POST['submitdownloads']; //standard variables are easier to work with
                    
    if(isset($_COOKIE[$formid])) { 
                        if(
    $_COOKIE[$formid]) >= 
                            echo 
    "Thanks for submitting your downloads, you have now reached the limit";
                            } else {
                        
    $_COOKIE[$formid] += 1;
                            echo 
    "Submitting data...";
                            } else { 
                        
    setcookie($formid186400); //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!
    Last edited by Chris-2k; 05-23-2011 at 03:09 PM.

  • #11
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,345
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    Change:
    PHP Code:
    ($_COOKIE[$formid]) >= 
    to:
    PHP Code:
    ($_COOKIE[$formid] >= 
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #12
    Regular Coder
    Join Date
    May 2011
    Posts
    303
    Thanks
    29
    Thanked 0 Times in 0 Posts
    ok thx, done:

    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($formid186400); //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
    ty indeed.

  • #13
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts
    You cannot have an else statement after an else statement. I don't think I need to explain why.
    "Yeah science!"
    Online Science Tools

  • #14
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,345
    Thanks
    60
    Thanked 527 Times in 514 Posts
    Blog Entries
    4
    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.
    Last edited by tangoforce; 05-23-2011 at 11:18 PM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #15
    Regular Coder
    Join Date
    May 2011
    Posts
    303
    Thanks
    29
    Thanked 0 Times in 0 Posts
    Okay ty, now i end the page like:

    PHP Code:
    <?php

    ?>
    and get this error:

    Code:
    Parse error: syntax error, unexpected $end in /home/chris2009/xtremeddl.net/submit.php on line 185
    thats just how the Wcddl script ends pages.. any ideas?


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •