Results 1 to 3 of 3

Thread: Looping Error

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    9

    Looping Error

    I have PHP loop. When I execute the page is blank. Why

    [quote]
    echo(<?php for ($x = 1; $x < 1000; $x++) ?>)
    {
    <form onsubmit="echo($x) > // submit form each
    </form>
    }

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Looping Error

    uhh. probably because that isn't even close to having the correct syntax for a for() loop? the code you posted wouldn't even run.

    PHP Code:
    <?php for($i 1$i 1000$i++){ ?>
      <form onsubmit="<?php echo $i?>">
        
      </form>
    <?php ?>
    besides, even if you did run the script above, you're only printing the <form> tag. the <form> tag has no visual features, so it will always result in a blank page. you'd have to actually print out text for the script to have anything visible on a web browser when run. that is, unless you actually planned on having the random echo and curly brackets outside of the form in the first place (but I can't imagine why).

    and you do realize printing out 1000 different forms isn't really going to do much, right? I can only hope that you're just doing this to test how the for() loop works? 1000 a little much, though.

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Looping Error

    I suggest you take a course in programming. We can help you with specific problems, but we can't teach you everything, nor can we do your work for you.

Posting Permissions

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



Click Here to Expand Forum to Full Width