Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: How do I post form a hidden to random page

  1. #1
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How do I post form a hidden to random page

    I have this code. The red colored links represent the randomized links i intend the to have the forms posted to. I just need to know if someone could please write the code needed to apply this code or something like it. Essentially I just need the page forwarding script to execute and move some variables in a hidden form to the page that it is directed to go to via the forwarding script. So the red links need to fill the green spot on the form. But i also need the form to be submitted automatically. I don't know any better way to explain it.

    I will also need to know how to put the randomURL into the method area, i have tried several things it just does not want to work. If anyone wants to jump in on this one for assistance please help.

    I am somewhat new to things and my understanding of terminology is still lacking, so I pretty much have to google things if I have difficulty coding it myself. If I cant find it on google I proceed to ask on forums as a last resort. Any help with this would be extremely appreciated.


    Code:
    <script language="JavaScript">
    <!--
    day = new Date();
    hr = day.getSeconds();
    if ((hr >= 0) && (hr <= 6)) {
    randomURL = "http://cherry.com/chatroom.php";	}	
    if ((hr > 6) && (hr <= 12)) {		  randomURL = "http://apples.com/chatroom.php";	 }	 
    if ((hr > 12) && (hr <= 18)) {		 randomURL = "http://blah.com/chatroom.php";	 }	 
    if ((hr > 18) && (hr <= 24)) {		  randomURL = "http://pears.com/chatroom.php";	}	 
    if ((hr > 24) && (hr <= 30)) {		  randomURL = "http://grapes.com/chatroom.php";	 }	 
    if ((hr > 30) && (hr <= 36)) {		  randomURL = "http://desksandchairs.com/chatroom.php";	 }	 
    if ((hr > 36) && (hr <= 42)) {		  randomURL = "http://peaches.com/chatroom.php";	 }	 
    if ((hr > 42) && (hr <= 48)) {		  randomURL = "http://tigerlillies.com/chatroom.php";	 }	 
    if ((hr > 48) && (hr <= 54)) {		  randomURL = "http://foriegner.com/chatroom.php";	 }	 
    if ((hr > 54) && (hr <= 60)) {		 randomURL = "http://pianos.com/chatroom.php";	 }	
    document.write("<meta http-equiv='refresh' content='3;url=" + randomURL + "'>");
    // -->
    </script>

    Code:
    <form action="The spot where forwarding link goes" method="post">
    <br><input type="hidden" name="variable1" value="<? echo $_POST['blah']; ?>">
    <br><input type="hidden" name="variable2" value="<? echo $_POST['hmmmm']; ?>">
    <br><input type="submit" value="Submit!">
    </form>

  2. #2
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I guess everyone is sleeping today.

  3. #3
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Hmm, I'm a little confused here - is the form on the page the javascript refreshes to?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  4. #4
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It's not suppossed to refresh. It's supposed to have a different load for each interval.

  5. #5
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    I understand that...what I'm asking is which page the form is on...?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  6. #6
    Join Date
    Dec 2006
    Location
    Near Derby, UK
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    does...

    HTML Code:
    document.FORMNAME.action='somepage.html' ;
    Or

    HTML Code:
    document.getElementById('FORMID').action='somepage.html' ;
    ...not work?!?!?

  7. #7
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The form is supposed to be hidden into "the page forwarding script" page. I just need a way to have varialbles from a previous form to be passed through the page with the page forwarding script. Inserting a a "hidden form" so that automatically submits into the "page forwarding script page" so that the end page receives the variables. I figured would be the best way... however figuring out how to do it is another thing.

    Heres an example
    Last edited by W3Bster; 08-02-2007 at 03:37 PM.

  8. #8
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Alright, what server side language are you using?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

  9. #9
    Join Date
    Jul 2007
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Its a php website.

    OS: Debian Linux
    PHP Ver: 5.1.6
    MySQL Ver: 5.0.27
    Last edited by W3Bster; 08-02-2007 at 10:27 PM.

  10. #10
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    Alright, then why're you using javascript for this?

    PHP Code:
    <?php session_start();

    $_SESSION['blah'] = isset($_POST['blah']) ? $_POST['blah'] : 'empty';
    $_SESSION['hmm'] = isset($_POST['hmm']) ? $_POST['hmm'] : 'empty';

    $hr date('s');

    if(
    $hr >= 00 && $hr <= 6){ $randomUrl 'http://cherry.com/chatroom.php';}
    if(
    $hr && $hr 12){ $randomUrl 'http://apples.com/chatroom.php';}
    .
    .
    .
    //and so on

    header('Location:'.$randomUrl);

    ?>
    Ok, so now what we've done is replaced all javascript and made a way to save the info sent through the form on the previous page. We've set sessions so that on, say, cherries.com/chatroom.php we can do this:

    PHP Code:
    <?php session_start();

    $blah = isset($_SESSION['blah']) ? $_SESSION['blah'] : 'no blah session!';
    $hmm = isset($_SESSION['hmm']) ? $_SESSION['hmm'] : 'no hmm session!';

    ?>

    <h1>Welcome, I just wanted to say <?=$blah ?></h1>
    <h1>Oh, and by the way...<?=$hmm ?></h1>
    If you want any of this explained, just ask. You must have the session_start(); before any content is echoed. (It's easy to just drop it right after the opening php tags)

    Hope this helps.
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

Bookmarks

Posting Permissions

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