query string passing woes........ help... please....



ok, this is my first attempt at php and this all seemed simple enough
when I started. Well everything's working except one thing.

This page is being passed emailaddress in a query string:
http://www.chaparralmedia.net/brochureRequests/contact.htm?emailaddress=r_coan%40hotmail.com

How do I get that from contact.htm to a varible in my contact.php
page? I'm trying to make the php script send an email with the form
data to the email address (emailaddress) but I can't seem to get it to
work.

I'm lost... and frustrated.... I spent all day yesterday working on
this. An hour getting the form and my varibles ready, then the rest
of the day trying different things to get this to work. Any help will
be greatly appreciated as I was supposed to have this live
yesterday :~(

Here's my php.

?php


// get posted data into local variables
$EmailFrom = "rcoan@xxxxxxxxxxxxxxxxxx";
$EmailTo = $_GET['emailaddress'];
$Subject = "Chaparral Boats Lead";
$Name = Trim(stripslashes($_POST['Name']));
$Address1 = Trim(stripslashes($_POST['Address1']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Zip = Trim(stripslashes($_POST['Zip']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Email = Trim(stripslashes($_POST['Email']));
$ssi = Trim(stripslashes($_POST['ssi']));
$ssx = Trim(stripslashes($_POST['ssx']));
$sig = Trim(stripslashes($_POST['sig']));
$sun = Trim(stripslashes($_POST['sun']));
$dvd = Trim(stripslashes($_POST['dvd']));


// validation
$validationOK=true;
if (Trim($Name)=="") $validationOK=false;
if (Trim($Address1)=="") $validationOK=false;
if (Trim($City)=="") $validationOK=false;
if (Trim($State)=="") $validationOK=false;
if (Trim($Zip)=="") $validationOK=false;
if (Trim($Phone)=="") $validationOK=false;
if (Trim($Email)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}

// prepare email body text
$Body = "";
$Body .= "The following person has requested more information on
Chaparral Boats. Please send Brochures and/or DVD's in a timely
manner. If you should require extra materials please contact
Chaparral.";
$Body .= "\n";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Address: ";
$Body .= $Address1;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State/Providence/Territory: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Zip Code: ";
$Body .= $Zip;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "EmailAddress: ";
$Body .= $EmailAddress;
$Body .= "\n";
$Body .= "SSiBrochure? ";
$Body .= $ssi;
$Body .= $ssx;
$Body .= $sun;
$Body .= "\n";
$Body .= "SignatureBrochure? ";
$Body .= $sig;
$Body .= "\n";
$Body .= "DVD? ";
$Body .= $dvd;
$Body .= "\n";



// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=er.htm\">";
}
?>

==========================================================================
Here's my html:
==========================================================================

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>


<style type="text/css">
<!--
..style4 {
color: #CC0000;
font-weight: normal;
}
..style6 {
color: #003366;
font-size: large;
}
..style7 {color: #CC0000}
-->
</style>

</head>
<body>


<form method="POST" action="contact.php">
<div align="left">
<p><img src="images/Chap_Logo_Chrome_Wet.jpg" alt="Chaparral Boats
Request Information | Brochures | DVD's " width="360" height="139" /></
p>
<p class="style6"> Information Request Form</p>
<p class="style7">Fields marked (*) are required </p>
</div>

<input name="emailaddress" id="emailaddress" value="<%=emailaddress
%>">

<p align="left">Name:*
<input type="text" name="Name">
<p align="left">Address:*
<textarea name="Address1"></textarea>
<p align="left">City:*
<input type="text" name= "City">
<p align="left">State or Province:*
<input type="text" name="State">
<p align="left">Zip Code:*
<input type="text" name="Zip">
<p align="left">Phone:*
<input type="text" name="Phone">
<p align="left">Email Address:*
<input type="text" name="Email">
<p align="left">==============================================
<p align="left"><b>Brochure Request</b><br />
<br />

<input type="checkbox" name="ssi">SSi Sportboats<br />
<input type="checkbox" name="ssx">SSX Sportdecks<br />
<input type="checkbox" name="sig">Signature Cruisers<br />
<input type="checkbox" name="sun">Sunesta Deckboats<br />
<p align="left">==============================================
<p align="left"><b>DVD Request</b><br />

<input type="radio" name="dvd" value="SendDVD" />
Yes <br />
<input type="radio" name="dvd" value="NoDVD" checked/>
No
<p align="left">

<input type="checkbox" name="emailUpdates" vlaue="checked" checked/>
I would like to receive email discounts and pre-release product
information from Chaparral Boats.<br /><br />
<p align="left"><span class="style4">All information submitted is held
confidential and not distributed to third parties.<br />
</span><br />

<input type="submit" name="submit" value="Submit">
</form>

</body>
</html>

==============================================================================
==============================================================================

What can I do to make this happen? I'm at my wits end.... I've
mulled over this simple code for waaayyyy too many hours and I'm in
the same place this morning as I was yesterday morning at this time.

.



Relevant Pages

  • Re: How do we get there from here?
    ... > then sub the whole of that generated markup into the template? ... layed out on the fly, a simple IMG tag, or even an entire HTML document. ... PHP scripting provides 10 times the features of both of these ... idea as tokens can eliminate a huge amount of maintance, ...
    (comp.databases.pick)
  • Re: query string passing woes........ help... please....
    ... |> | offer any help other than saying that my validation could be FAR more ... I'm a total newbie at php. ... The easiest way for you would be to make the html form called form.php ... $_SESSION array using the same names. ...
    (alt.php)
  • Re: HELP - Cant change Include Path
    ... Here is my php.ini path for the php.ini in both php and sql dirs: ... which did work on the remote linux server and sent me some mail ... Although my gmail acct picked the mail up as ... an attachment instead of as html - but gmail is really wierd about ...
    (comp.lang.php)
  • Re: How do we get there from here?
    ... server-side-scripted html. ... This is a simple example with very little php scripting. ... means that the version of the php pre-processor on your web server must ... >>> The browser never sees anything not sent to it by the script. ...
    (comp.databases.pick)
  • Re: PHP-Yes, HTML-No --- Why?
    ... Because the files, when downloaded, are called .php and have absolutely no php in them:) ... But the extension doesn't match the contents of the file. ... Surely a dynamic web server should appear exactly the same as a static one - all files that contain HTML when viewed should be called .html. ...
    (comp.lang.php)