Jump to content


Photo

forms using post and/or get statements


  • Please log in to reply
4 replies to this topic

#1 deemurphy

deemurphy
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 15 June 2005 - 09:42 PM

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

#2 Matt B.

Matt B.
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 June 2005 - 12:10 AM

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)
Matt B.
<?php echo "Hello World!"; ?>

#3 deemurphy

deemurphy
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 16 June 2005 - 12:36 AM

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)

View Post


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...ml4/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/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...ml4/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[email]\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[email]";
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

#4 deemurphy

deemurphy
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 18 June 2005 - 08:14 PM

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...ml4/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/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...ml4/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[email]\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[email]";
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

View Post



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

#5 Matt B.

Matt B.
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 20 June 2005 - 08:43 PM

Sorry I forgot about this post. I'm taking a look at it as we speak, but in the meen time what exaclty are you trying to do with this script?
Matt B.
<?php echo "Hello World!"; ?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users