Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > redirect users to a URL that has PHP variables populated in it
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 28th February 08:47
bridgemanusa
External User
 
Posts: 1
Default redirect users to a URL that has PHP variables populated in it



Hi All:

I am pretty much a newbie to PHP and have (what should be) a pretty
basic question:

I have a html form (5 text fields) that does a post to my php script
page. I grab the form elements from the form and store them in each of
5 variables (got ths part working fine and verified with print
statements).

I then want to:

1) build a url appended with values from the variables included
2) redirect the user to the URL (need to use GET method for this)
3) here I then parse the url for the elements and then populate another
form containing 3 fields (2 text, 1 text area).

The hitch is that 3 of the 5 variable values have to end up in the text
area (named textarea1, seperated by commas) along with their text field
names to label them.

<? php
$Fname = $_REQUEST['Fname'];
$Lname= $_REQUEST['Lname];
$Item1 = $_REQUEST['Item1'];
$Item2 = $_REQUEST['Item2'];
$Item3 = $_REQUEST['Item3'];

//this is where I totally lose it, especially with the syntax and I
maybe need URLencode?

redirect"http://www.mysite.com/collectpage.asp?Fname=[$Fname]&Lname={$Lname]&textarea1=item1:[$Item1],Item2:[$Item2],Item3:{$Item3]

?>

So the final textarea should be poplated with a value of
"Item1:item1value, Item2:Item2value, Item3:item3value"

Yes, the form redirected to is an ASP page (out of my control, no acces
to the code and just need to pas the form values).

Thanks in advance for any help.


Eric B
  Reply With Quote


  sponsored links


2 28th February 08:47
ken robinson
External User
 
Posts: 1
Default redirect users to a URL that has PHP variables populated in it



You need to use the header() function here:

<?php
header('location: http://www.mysite.com/collectpage.asp?Fname=' .
$Fname . '&amp;Lname=' . $Lname . '&amp;textarea1=item1:' . $Item1 .
',item2:' . $Item2 . ',item3:' . $Item3);
?>

The dot ( . ) operator is used for string concatenation.

Ken
  Reply With Quote
3 28th February 08:47
meião
External User
 
Posts: 1
Default redirect users to a URL that has PHP variables populated in it


why not use get instead of post
this way you can jump directly from what you have to 3

there just echo the variables into inputs value field or between
textarea tags
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666