form value not taking.......

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Swathimaddipatla
Forum Newbie
Posts: 9
Joined: Fri May 09, 2008 7:08 am

form value not taking.......

Post by Swathimaddipatla »

Hi...
am using calender to select DOB in my form..
for that i have used java script.
how need to take value of DOB from form and need to insert into DB
my form is
<html>
<head>
<script language="JavaScript" type="text/javascript" src="calendar.js"></script>
</head>
<body>
<form action="action.php" method="post">
<table>
<tr>
<td width="117"><b>Date of birth</b></td>
<td width="14">:</td>
<td width="357"><script>DateInput('birthdate', true, 'YYYY-MM-DD')</script></td>
<td><input type="button" onClick="alert(this.form.birthdate.value)" value="Show date value passed"></td>
</tr><tr><td></td><td><input type="submit" name="Register" id="Register" value="Register" ></td></tr></table></form></body>
</html>

And in action.php i have given
<?php
if (isset($_POST['Register']))
{
$dob = $_POST['birthdate'];
some insert stmt....
}
?>
but its not working...
pls tell me how to solve this...
Now how to pass javascript variable into php
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: form value not taking.......

Post by WebbieDave »

Swathimaddipatla wrote:but its not working...
What happens? What's in the $_POST array? Try:

Code: Select all

var_dump($_POST);
If it contains Register but not birthdate, you'll need to troubleshoot your usage of this particular Javascript library.

Also, try changing the method to get temporarily so you can more easily examine what's being sent (you can change $_POST to $_REQUEST or $_GET to access the parameters).
Post Reply