Re: Passing JavaScript variables to PHP
| From: | (Craig Gardner) | Date: | Wed, 01 Aug 2001 15:44:06 +0000 |
| Subject: | Re: Passing JavaScript variables to PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60707@lists.php.net to get a copy of this message | ||
Here's a more detailed explanation of my problem. I am setting up a
form with multiple text boxes. I am trying to send a formatted
version of the form, via e-mail... Here's kinda how I have it layed
out.
<html>
<head>
<script language='javascript'>
function formatText()
{
message = 'Textbox label1 : ' + document.forms[0].text1.value +
'\n';
message = 'Textbox label2 : ' + document.forms[0].text2.value +
'\n';
message = 'Textbox label3 : ' + document.forms[0].text3.value +
'\n';
message = 'Textbox label4 : ' + document.forms[0].text4.value +
'\n';
location.href='mail.php?message=' + message;
}
</script>
</head>
<body>
<form method='post'>
<input type='textbox' name='text1'>
<input type='textbox' name='text2'>
<input type='textbox' name='text3'>
<input type='textbox' name='text4'>
<input type='button' value='Submit'
onClick='javascript:formatText'>
</form>
</body>
</html>
mail.php has just a basic php mail function call and a thank you
message.
When I test this, it sends the e-mail, but the message isn't there.
I think it is because of the line breaks I added to the message. What
can I do to get this working?
Also, I don't have a perl script to do this for me...
Thanks.
Craig