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

Mark mark_weinstock at yahoo.com
Tue Jan 21 11:05:57 CST 2003


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>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript


=====
Mark Weinstock
mark_weinstock at yahoo.com
***************************************
You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing.
-Stolen from the now-defunct Randy's Random mailing list.
***************************************

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the Javascript mailing list