1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Rep Power
    OK, I have a main page that has two fields.
    1 is a email field, another is a name field.
    Below that are radio buttons.

    What I want, but does not work ----

    when you fill out the two fields with your email and name
    you also check a radio button of your choice. The radio button that is selected is suppose to send you to another web page that the radio button is suppose to route to.
    when you hit the submit button, it calls my web.php3 page to fill my Mysql table with the name and email but also I want to send the person to a another web site based on with radio button the user selected.

    The result I get, but do not like is.

    1. it writes to my Mysql table (good)
    2. it loads my web.php3 page up on the browser (bad)
    3. loads up the web page the person selected from the radio
    button into a second browser (bad)

    What I want is.
    1. write to my tables
    2. do not load the web.php3 page up
    3. only loads the web page the user selected but in the same browser, not open of a new browser.

    I'm Mixing Java sript with PHP. Using PHP to write to the database, and java script to do everything else.

    can anyone help. thanks

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Rep Power
    Just use the nifty header() function in PHP. eg:

    header ("Location: <A HREF="http://www.php.net");" TARGET=_blank>http://www.php.net");</A>

    Look for information about this function at http://www.php.net/manual/function.header.php

    Place this code BEFORE your html code, or the header command will not work.

    PHP, Perl, SQL Programming at http://www.mentalobjects.com
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Perth West Australia
    Rep Power
    in web.php3 page - no html - just:

    your connect to database routines then

    <script>window.location.href="<?php echo $varfromfrom;?>.php3"</script>


    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Rep Power
    you can try the following.just remove the java script from your script.becoz that may create some trouble in old versions of browsers(i mean redirect script).

    call the web.php3 from the html form.

    here is an example,


    <form method="post" action="web.php3">
    Name : <input type="text" name="fullname">
    Email : <input type="text" name="email_address">

    URLS :
    <input type="radio" name="radio" value="http://shiju.dreamcenter.net" checked>

    <input type="radio" name="radio" value="http://www.yahoo.com">
    <input type="submit" name="submit" value="submit">

    just use the following script for web.php3.don't put any html code before header() function.




    $userip = getenv("REMOTE_ADDR");

    $con=mysql_connect (localhost, xxxxxx, xxxxxxx);

    mysql_select_db (register1,$con);

    mysql_query ("INSERT INTO email_info (fullname, email_address, userip)
    VALUES ('$fullname', '$email_address', '$userip')

    header ("Location: $radio");


    echo "Error !! contact administrator for detailsn";


    don't use "target=_blank" in html form(ie ,<form action="" method="" target="_blank"> )

    that is why it is opening the page in another window.

    hope this may help you to solve your problem...

    SR -

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited May 25, 2000).]
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Alkmaar, The Netherlands
    Rep Power
    Don't use any HTML in your web.php3 at all.

    Insert your info into MySQL, set your cookies or whatever. Then use a redirect to the page they selected with header("Location: whateverpage.php3");

    Good luck,

    E-mail me at b.vandermeijden@pecoma.nl

Similar Threads

  1. Replies: 2
    Last Post: February 2nd, 2004, 07:39 AM
  2. php code to use variables from the url
    By Nullified in forum PHP Development
    Replies: 2
    Last Post: January 30th, 2004, 02:19 PM
  3. Display and Refresh of PHP in URL query
    By wuji in forum PHP Development
    Replies: 3
    Last Post: January 30th, 2004, 12:20 PM
  4. replace URL with PHP,
    By stage_watchman in forum PHP Development
    Replies: 4
    Last Post: January 18th, 2004, 09:31 AM
  5. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo