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.
Results 1 to 6 of 6

Thread: Auto loop Form

  1. #1
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts

    Auto loop Form

    I'm trying to get it to post to my forum with a different twist (a new website etc, long story short)


    But right now I'm trying a simple test of this method. So I'm having it submit data to a page multiple times...

    PHP Code:

    <?

    $i 
    1

    do {

    ?>

    form info here

    <?

    $i
    ++

    }

    while(
    $i <= 10);

    ?>

    In the form, it'll change just one value, and then resubmit it until that value = 10.


    Really simple to do, but I don't know how to get a form to automatically submit. Right now, it'll just display the form 10 times DD:

    Also, I don't know any of the variables on the next page. I'm pretty sure it uses post data, because it doesn't show up in the url :P.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Where is the bit that is supposed to submit the form?

  • #3
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    uhm, For now I'll just make it a random page =/.

    So it'd be something like:

    <form action=thispage.php method=post>

    then just a few text input boxes...

    but the main thing I can't figure out is how to send the all the looped/changed data to the page.

    I'm developing it to make 100 posts in a thread instantly.

    Point is, once I get it to auto submit, I can get it setup with the current data in the forum via modifications. But I need to know how to set it up to do that :P.


    So it sends the data, rather than shows the form multiple times.
    Last edited by Deacon Frost; 12-17-2008 at 05:07 PM.

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    OK well you can't really do it that way. Your browser is the mechanism that submits a form which then sends a POST or GET HTTP request back to the webserver, which then processes your PHP script, which then heads back out to your browser.

    So your loop would have to include that entire journey, which can't be achieved inside a PHP script, which is only part of the journey.

    You'll probably be able to do this on the client side using Javascript.

    p.s. there is actually a way to send HTTP requests to the webserver using PHP, which could of course be put inside a loop. However I wouldn't see the point, if what you really want to test, or exercise, is the form submittal process. But if you want to give it a shot, look into fsockopen(), and/or curl.

    http://us.php.net/manual/en/function.fsockopen.php

    http://us.php.net/manual/en/intro.curl.php

  • #5
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    Awesome .

    I tried both of those, neither worked (well) to my level of ability.

    So, I am focusing on the document.form.submit function in javascript, and I can figure it out, but I can't grasp the concept of the idea of sending all the data at once.

    What I am trying to do... to make it really simple, is use a for loop in javascript, and send the data (not echo, but send the data) to the page all at once after it's collected it.

    My idea is to store it all in an array, and then send the arrays, each holding the info from each one.

    but then I'd have to alter all of the other pages, which I can't do since it's a premade script (and uses so many different inserts it's not even funny).

    So what I need to do is put all of the post data on the same page as the forms for a certain number of time. and then it just submit all of that at once (as different forms).


    Can anyone give me a headache break with some potential possibilities? This really has my head raped right now XD.

  • #6
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    Can someone move this to JavaScipt please?

    Or should I just repost it there?


  •  

    Posting Permissions

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