473,396 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems with javascipt and form

hello
I have this code for the first page
Expand|Select|Wrap|Line Numbers
  1. <form name=form>
  2. ...
  3. Date of registration:
  4. <script name="dt">
  5. d=new Date();
  6. AffDate(d);
  7. </script>
  8. ....
  9. </form>
  10.  
and i have to insert the date in a table sql using another page
Expand|Select|Wrap|Line Numbers
  1. if(isset($_POST["document.form.getElemnetsByTagName('script')"]))
  2.  
  3. $dt=$_POST["document.form.getElemnetsByTagName('script')"];
  4.  
  5.  
  6. include('MySQLConnection.php');
  7. $result=mysql_query("INSRET INTO registration (ID_etu, level_etu, class_etu, section_etu, date_reg ) 
  8. values('', '".$rb."', '".$C."', '".$rd1."', '".$dt."'");
  9. $sql=mysql_query($result. "mysql_error()");
  10. ?>
  11.  
It gives me error: Notice:
Undefined variable: dt in C:\wamp\www\www\Register.php on line 27

Could you inform me why? And what to do?

Thanks
Aug 28 '10 #1
1 1037
Dormilich
8,658 Expert Mod 8TB
you cannot use JavaScript and PHP at the same time. PHP runs at the server and JavaScript at the client. two completely separated timelines. that is, you would have to put in the form fields’ names manually.

second, only named form fields (<input>, <select>, <textarea>) submit values, the other HTML elements don’t.

and while I’m at it, the function is called getElementsByTagName().
Aug 28 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
1
by: Clive Moore | last post by:
I am trying to hide a drop down box in a form on a jsp page using the: style.visibility="hidden"; The form element is hidden ok but my problem is that the space still exists where the element...
2
by: Andy Goldstein | last post by:
I have a table where all the TRs have an onClick handler registered. One (and only one) of the rows has 2 text input boxes, where each textbox has an onChange handler registered. Both the onClick...
5
by: Tyler Style | last post by:
Hullo - looking for a little advice here. I have a form on a page in one domain submitting to a cgi in another domain. Weirdly, on some Windows XP systems, a form on the page fails to submit/post...
2
by: sfriedman | last post by:
I was able to successfully link my Outlook Contacts table to an Access Database and create an entry form. Unfortunately the Displayname field which is one of the key fields for how the contact is...
2
by: cwhite | last post by:
I'm having problems with a form based query The user makes a selection from a drop box, there are only two choices: Current Former the user makes a choice and clicks the preview report...
2
by: Neil Jones | last post by:
I am having difficulty with a form processing script. This cut down version also exhibits the problem The idea is to input the data and then click the submit button to process it, but it just...
2
by: Zull | last post by:
I've got a base form wich is a parent form for few others. On this base form I have dataGridView control, which has Modifiers property set on 'Protected Internal'. Unfortuantely, it does not...
3
by: dtvuser | last post by:
Hi, I'm new to PHP and seem to be having soom problems, I'm getting confused with all the different styles of script writing. I've created a PHP script to submit details to my email but the...
6
by: Spartacus | last post by:
Hello, I have an HTML form I'd like to process. <select name="items" multiple> <option value="doughnuts">Hot Doughnuts</option> <option value="coffee">Hot Brewed Coffee</option> <option...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.