Jump to content

Recommended Posts

I am not getting variables from one script to another.

 

If I could send these files to someone or post them on this site can someone try it on their system and tell me what is wrong. I would like to be able to pass variables from one script to another script.

 

Thanks

Dee

Link to comment
https://forums.phpfreaks.com/topic/2356-forms-using-post-andor-get-statements/
Share on other sites

I'll give it a try. Just post the file on the forums and i'll copy/paste it into my Dreamweaver and take a look at it. (Just being a little carefull. Downloading scripts can be dangerous, not to say that you would do that)

242902[/snapback]

 

Thanks Matt. Here is the code to the first script.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Products</title>

</head>

 

<body>

<img src="http://images.google.com/images?q=tbn:eMqGzBOAocEJ:www.wedowed.com/gc187.jpg">

<form action="newproducts.php" method="post">

<Strong>Select A Product</Strong><br>

<select name="name[]" multiple>

<option value="Baseball Bat">Baseball Bat</option></option>

<option value="Mitt">Mitt</option></option>

<option value="ball">Baseball</option>

<option value="uniform">Uniform</option></select>

<p><strong>Summary:</strong><br>

<input type="text" name="summary" size="40"></p>

<p><strong>Price:</strong><br>

<input type="text" name="price" size="10">

<p><input type="submit" value="submit your request"></P>

</form>

 

</body>

</html>

 

Here is the code to the second script:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Newproducts.php</title>

</head>

 

<body>

 

<?php

 

$products = array(

array(

"Name:" => "Baseball Ball",

"Summary:" => "Made of Aluminum",

"Price:" => "$100",

)

);

foreach ($products as $p) {

while (list($k, $v) = each ($p)) {

echo "$k $v <br>";

echo $_post['$k $v<br>'];

}

};

 

echo "<p><strong>Description:</strong><br>";

echo "<p>This bat is garanteed to hit home runs every single time you strike the ball.";

echo "<p>No strikeouts or pop fly balls with this beauty.";

echo "<p>Check it out!</p>";

$msg = "Name: $_post[username]\n";

$msg .= "E-Mail: $_post\n";

$msg .= "Phone: $_post[phone]\n";

$msg .= "Comment: $_post[comment]\n";

$recipient = "nookala@traderonline";

$subject = "For Submission Results";

$mailheaders = "From: My Web Site <deemurphy_us@yahoo.com> \n";

$mailheaders .= "Reply-To: $_post";

mail($recipient, $subject, $msg, $mailheaders);

 

?>

<form action="newtext.php" method="post" enctype="application/x-www-form-urlencoded">

<p><strong>Name:</strong><br>

<input type="text" name="username" id="username" size="25">

<p><strong>E-Mail:</strong><br>

<input type="text" name="email" id="email" size="25">

<p><strong>Phone:</strong><br>

<input type="text" name="phone" id="phone" size="12">

<p><strong>Comment:</strong><br>

<textarea name="comment" rows="5" cols="40"></textarea></P>

<p><input type="submit" value="send"></p>

</form>

 

</body>

</html>

 

 

Also is there a way to have all this in one script file?

 

Thanks so much for your help.

Dee

Thanks Matt.  Here is the code to the first script.

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Products</title>

</head>

 

<body>

<img src="http://images.google.com/images?q=tbn:eMqGzBOAocEJ:www.wedowed.com/gc187.jpg">

<form action="newproducts.php" method="post">

<Strong>Select A Product</Strong><br>

<select name="name[]" multiple>

<option value="Baseball Bat">Baseball Bat</option></option>

<option value="Mitt">Mitt</option></option>

<option value="ball">Baseball</option>

<option value="uniform">Uniform</option></select>

<p><strong>Summary:</strong><br>

<input type="text" name="summary" size="40"></p>

<p><strong>Price:</strong><br>

<input type="text" name="price" size="10">

<p><input type="submit" value="submit your request"></P>

</form>

 

</body>

</html>

 

Here is the code to the second script:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Newproducts.php</title>

</head>

 

<body>

 

<?php

 

$products = array(

                array(

      "Name:" => "Baseball Ball",

      "Summary:" => "Made of Aluminum",

      "Price:" => "$100",

    )

  );

foreach ($products as $p) {

  while (list($k, $v) = each ($p)) {

      echo "$k $v <br>";

    echo $_post['$k $v<br>'];

      }

};

 

echo "<p><strong>Description:</strong><br>";

echo "<p>This bat is garanteed to hit home runs every single time you strike the ball.";

echo "<p>No strikeouts or pop fly balls with this beauty.";

echo "<p>Check it out!</p>";

$msg = "Name:  $_post[username]\n";

$msg .= "E-Mail: $_post\n";

$msg .= "Phone: $_post[phone]\n";

$msg .= "Comment: $_post[comment]\n";

$recipient = "nookala@traderonline";

$subject = "For Submission Results";

$mailheaders = "From: My Web Site <deemurphy_us@yahoo.com> \n";

$mailheaders .= "Reply-To: $_post";

mail($recipient, $subject, $msg, $mailheaders);

 

?>

<form action="newtext.php" method="post" enctype="application/x-www-form-urlencoded">

<p><strong>Name:</strong><br>

<input type="text" name="username" id="username" size="25">

<p><strong>E-Mail:</strong><br>

<input type="text" name="email" id="email" size="25">

<p><strong>Phone:</strong><br>

<input type="text" name="phone" id="phone" size="12">

<p><strong>Comment:</strong><br>

<textarea name="comment" rows="5" cols="40"></textarea></P>

<p><input type="submit" value="send"></p>

</form>

 

</body>

</html>

Also is there a way to have all this in one script file?

 

Thanks so much for your help.

Dee

 

 

I never did get an answer for this problem. Please help.

Dee

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.