Jump to content

[SOLVED] Sending email; variables not displaying.


Recommended Posts

I'm trying to convert a website away from frontpage extensions, due to the site host no longer supporting them, and I'm trying to use PHP for my forms, to do this.

 

I have a smaller PHP reference manual, with examples, and I was fairly certain that I followed them... except, well...

 

When the email comes through (and it comes through just fine, too) it shows all of the text I have, with none of the variables that should have been passed from the previous form.

 

The form is on a standard HTML page:

<form action="list-your-cottage-rental.php" method="post">

		<input type="hidden" name="formVer" value="CotW Cottage Rental V1.8.2009">


  
		<table border="1" width="100%" cellpadding="3" bordercolor="#000000" style="border-collapse: collapse">
			<tr>
				<td bgcolor="#FFFFCC"><b>Personal Information</td>
			</tr>
		</table>
			<p><b>Full Name(s):<br>
				<input type="text" name="strClName" size="40"><br>
				<br>
				Telephone Number(s):<br>
				<input type="text" name="strClPhone" size="40"><br>
				<br>
				E-mail Address:<br>
				<input type="text" name="strClEmail" size="40"><br>
				<br>
				Mailing Address:<br>
				<textarea rows="4" name="strClMailing" cols="30"></textarea></b></p>

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

 

It's a longer form, but you get the idea...

 

The php page that it sends the information to ...


<html>

<head>

<title>Form Sent</title>
<link rel="stylesheet" type="text/css" href="../default.css" />
</head>

<body>


<?php

//	require_once('recaptchalib.php');

$toemail='my@emailaddress.com';
$body="
Form:					".$formVer."
Client Name:			".$strClName."
Client Phone:			".$strClPhone." \n
Client Email:			$strClEmail \n
Client Address:			$strClMailing \n";

$extra= 'From: $strClEmail';

$subject = $strClName;


$body = wordwrap($body, 70);

mail($toemail, $subject, $body, $extra);  //Email send
?>

**Some HTML letting them know that an email was sent**

 

You'll likely notice that it looks like I changed how it was being put into the email.  This was all in hopes of trying to find a working syntax, after some quick googlings of the general idea of my problem.

 

Anyways, the email sends just fine, it's the variables that just aren't there, that concerns me.

 

The email I get looks like this:

Form:

Client Name:

Client Phone:

 

Client Email:

 

Client Address:

No variables whatsoever.  The form is actually much longer, and so is the php, but I can't get ANY variables to pass through.

 

Am I overlooking something painfully simple, here?

 

Wow... that simple.  Strange that this book didn't mention it.  Although it is copyright 2003 from when I was in college...  has PHP really changed that much since then?  Wow...

 

Anyways, tested it out and it's working flawlessly.  Thank you very much for your assistance.

Wow... that simple.  Strange that this book didn't mention it.  Although it is copyright 2003 from when I was in college...  has PHP really changed that much since then?  Wow...

 

Anyways, tested it out and it's working flawlessly.  Thank you very much for your assistance.

 

Yes, but this was known since 2002, programmers just cannot write books very well. The issue of register_globals is just really sinking in and being acted on.

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.