Results 1 to 1 of 1

Thread: Non-js dynamic choice of "action=" in forms!

  1. #1
    Join Date
    Sep 2008
    Posts
    899

    Non-js dynamic choice of "action=" in forms!

    I asked around about this months ago, and was told (by everyone that responded) that I would have to use JavaScript onClick or onChange to do it.

    Not so.

    I've just had another one of those exhilerating breakthrough moments that make this all seem worthwhile.

    Using only php, I was able to choose which of three pages to send my form to by using radio buttons that are part of the actual form itself.

    I first made a made an "intermediary page" (really just a file) called "trans.php" to send my form to. In my form, I set action = "trans.php". This is trans.php:
    Code:
    <?php
    session_start();
    $_SESSION[entertainer]=$_POST[entertainer];
    $a = $_POST[SITE];
    header("location: $a");
    ?>
    No <html>, no tags, nothing but the above. "SITE" was the name of my three radio buttons (my url choices) on my form page. I then put <?php session_start(); ?> at the very top of each of the pages that are my choices for the "header("location: $a");" before ANYTHING else including my doctype, html tag, etc. I put <?php echo $_SESSION[entertainer] ?> in the appropriate place on each of the three potential ultimate destination pages where I wanted to echo the variable passed from the form, and POOF!, it freaking worked!
    I've gone even deeper into the rabbit hole and I'm nuts about it!
    Last edited by djlebarron; 28 Jun 2009 at 08:01 PM.

Similar Threads

  1. Need Some Help With Dynamic Data
    By echoindia756 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 29 Jun 2008, 03:55 PM
  2. Converting static site to dynamic.
    By Webdummy in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 09 Jun 2008, 04:44 PM

Posting Permissions

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