For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > Passing variables from one script to another using the POST METHOD









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Passing variables from one script to another using the POST METHOD
Todd

2006-01-10, 4:00 am

>From an HTML form, I am collecting 3 variables, 2 from a radio button


and one from an text box. I call a php script where I echo out what
has been selected and ask to confirm. Upon confirm I want to submit
those variables to be processed. The problem is I'm using another Post

Method to call another script to do the processing but those variables
do not get passed. I'm new to php and I'm researching what is the best

method to accomplish this. Here's a sample of simple confirmation
script where the 3 variables are passed from the html form. I need to
confirm the selections, then process the 3 variables. I realize this
is basic and I will also need to check using the isset function that
all 3 variables have been selected from the html form before
displaying. For now, I just want a confirmation of what has been
selected, then process the variables. Thx to all who can help.

<html>
<form action="process.php" method=post>
<?php


echo "You have selected $var1 and $var2 and $var3. Are you sure?";


?>
<br>
<input type=submit value="Confirm">
<html>

Ramya

2006-01-10, 4:00 am

In the above html page, you need to pass the 3 variables as hidden
values before submit button. So the values will be passed to another
page where you need to process using the values.

Jim Michaels

2006-01-16, 3:55 am

<html>
<form action="process.php" method=post>
<input type=hidden name=var1 value="<?=$var1?>">
<input type=hidden name=var2 value="<?=$var2?>">
<input type=hidden name=var3 value="<?=$var3?>">
<?php

echo "You have selected $var1 and $var2 and $var3. Are you sure?";

?>
<br>
<input type=submit value="Confirm">
<html>
<?php
if (isset($_POST['var1'])) {
process $_POST['var1'] and the rest somehow
}
?>

"Todd" <tmclean@algoma.com> wrote in message
news:1135874283.706545.289520@g14g2000cwa.googlegroups.com...
>
>
> and one from an text box. I call a php script where I echo out what
> has been selected and ask to confirm. Upon confirm I want to submit
> those variables to be processed. The problem is I'm using another Post
>
> Method to call another script to do the processing but those variables
> do not get passed. I'm new to php and I'm researching what is the best
>
> method to accomplish this. Here's a sample of simple confirmation
> script where the 3 variables are passed from the html form. I need to
> confirm the selections, then process the 3 variables. I realize this
> is basic and I will also need to check using the isset function that
> all 3 variables have been selected from the html form before
> displaying. For now, I just want a confirmation of what has been
> selected, then process the variables. Thx to all who can help.
>
> <html>
> <form action="process.php" method=post>
> <?php
>
>
> echo "You have selected $var1 and $var2 and $var3. Are you sure?";
>
>
> ?>
> <br>
> <input type=submit value="Confirm">
> <html>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com