PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 25th, 2000, 09:21 PM
joescholar joescholar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 1 joescholar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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



Reply With Quote
  #2  
Old May 25th, 2000, 10:58 PM
esconsult esconsult is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 43 esconsult User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
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

Reply With Quote
  #3  
Old May 25th, 2000, 11:13 PM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 757 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 18 m 32 sec
Reputation Power: 14
in web.php3 page - no html - just:

<?php
your connect to database routines then
?>

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

Simon

------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

Reply With Quote
  #4  
Old May 26th, 2000, 12:27 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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,

test.htm

<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">
</form>

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

web.php3

<?php

if($submit){

$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')
",$con);


header ("Location: $radio");

}else{

echo "Error !! contact administrator for detailsn";
exit;
}

?>

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 -
shiju.dreamcenter.net

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



[This message has been edited by Shiju Rajan (edited May 25, 2000).]

Reply With Quote
  #5  
Old May 26th, 2000, 03:11 AM
MeijdenB MeijdenB is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: Alkmaar, The Netherlands
Posts: 123 MeijdenB User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
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,
Bas

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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > HELP !cant seem to get PHP to go to another URL

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap