I'm new member and newbie in PHP, i'm making php coding like this: (try.php)
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; echo '?date1=';echo $_POST['inputField']; echo '&date2='; echo $_POST['inputField2']; ?>" method="post">
<label for="DATE1">DATE1 </label><input type="text" size="12" name="inputField" id="inputField" value=<?php if(isset($_POST['inputField'])) {echo $_POST['inputField'];} else{echo date("Y-m-d");} ?> >
<label for="DATE2">DATE2 </label><input type="text" size="12" name="inputField2" id="inputField2" value=<?php if(isset($_POST['inputField2'])){echo $_POST['inputField2'];}else{echo date("Y-m-d");} ?> >
<input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>1. fill in DATE1 with such date 2012-04-01
2. fill in DATE2 with such date 2012-04-02
3. when i hit submit button , I want the result to be:
url address changes to be: try.php?date1=2012-04-01&date2=2012-04-02
what happens now is:
1. I fill in DATE1 with such date 2012-04-01
2. I fill in DATE2 with such date 2012-04-02
3. when I press submit, url address changes to be: try.php?date1=&date2=,
but strangely, when I press submit button once again, the result is correct , it become try.php?date1=2012-04-01&date2=2012-04-02
Please help me, sorry if my english is not good,
thank you very much for your help.
regards,
Bengkel