[Javascript] sending of variables via email...(makes more sense)

Jamesjackson73 at aol.com Jamesjackson73 at aol.com
Wed Jan 22 03:55:30 CST 2003


Mark or anyone else.
how do I set the value then? I thought the below lines was good enough...
and what dyou mean by 'check to make sure you have register.globals on in your php.ini'
***********
formNumber = (date + "" + month + "" + hour + "" + minute + "" + second);
document.write(formNumber); // writes to screen - works fine!
// End -->
</script>
<input type="hidden" name="formNumber" id="formNumber"> // doesn't work!
***********
If someone can change the code below to show me how that would be great.
I'm also no expert
Thanx in advance
Jim

In a message dated 1/21/2003 12:05:57 PM Eastern Standard Time, mark_weinstock at yahoo.com writes:

> I'm not a JavaScript expert, but you don't set the VALUE of
> formNumber anywhere. You set the id, but not a value. I thought you
> needed a Name and Value to set a value for a variable to be passed
> via a form.
> 
> Also, check to make sure you have register.globals on in your php.ini
> if you have any problems passing variables properly in PHP.
> 
> Mark
> 
> --- Jamesjackson73 at aol.com wrote:
> > Javascript/php/html experts... your'e bound to know how to...
> > 
experts
I have a form in which Ive used the Date() function to create a
unique numbering system which is different everytime a user
access's a page. but then (along with other form fields - not shown below) the contents of the fields entered would be shown when submit was pressed i.e. you entered... etc AND emailed using php, but I can't seem to transfer the complete value of 'formNumber'.
The HTML & HTML with PHP code is below. Please help!
Regards jimjacksonis at hotmail.com
 
 
***HTML***form2.html***
<html>
<head>
<title>form2</title>
</head>
<body>
<form name="form2mail" method="post"
action="http://www.uni.ac.uk/php-cgiwrap/form2mail.php3">
 
<script language="JavaScript1.2">
<!-- Gets now date&time -->
var time=new Date();
var date=time.getDate();
if (date<10)
date="0"+date
var month=time.getMonth() +1;
if (month<10)
month="0"+month
var hour=time.getHours();
if (hour<10)
hour="0"+hour
var minute=time.getMinutes();
if (minute<10)
minute="0"+minute
var second=time.getSeconds();
if (second<10)
second="0"+second
formNumber = (date + "" + month + "" + hour + "" + minute + "" +
second);
document.write(formNumber); // writes number to screen - works
fine!
// End -->
</script>
     <input type="hidden" name="formNumber" id="formNumber">
 
     <input name="submit" type="submit" id="submit" value="Submit
Form">
</form>
</body>
</html>
 
***PHP Script***form2mail.php3***
<html>
<head>
<title>form2mail</title>
</head>
<body>
<?php
 $formcontent = "";
 $formcontent .= "Form Number: $formNumber\n"; //Should take value of formNumber variable
 $toaddress = "myemailaddress at aol.com";
 $subjectline = "Form completed by me";
 $headers = "From: sender\n";
 mail( $toaddress, $subjectline, $formcontent, $headers);

 echo "
 <b>Thank you, The following email has been sent to 
 $toaddress:</b>
 <pre>$formcontent</pre>
 "; // end echo statement
?> // end php
</body>
</html>



More information about the Javascript mailing list