| | |
value doesnt get carried to next page
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Hi
i'm trying to display a default value in a atext field then when user changes it im grabbing it in javascript and passing it as a hidden variable but it doesnt work
everything else gets posted though only this is a hidden field i tried everyting else can anyone help????????
i'm trying to display a default value in a atext field then when user changes it im grabbing it in javascript and passing it as a hidden variable but it doesnt work
PHP Syntax (Toggle Plain Text)
//javascript function function save() { var imp = document.getElementById('yesno').checked; document.getElementById("schdate").value = document.getElementById('nextsch').value; if(imp == false) { <? $impt = 'N' ?> } else{ <? $impt = 'Y' ?> } alert ("date"+document.getElementById('schdate').value) //when i alert it had value } //form <form name="mainform" method="post" action="savesupdet.php?impt=<?= $impt ?>"> <td align='center' width='100'> <input type='text' id='nextsch' name='nextsch' value='<?= $nextsch?>'> </input> </td> <input type=hidden name=schdate id=schdate value = 'null'> </table> </form> </body> </html> // savesupdet.php file $cerll = $_POST['cerll']; $nextsch = $_POST['schdate']; $ta = $_POST['txta']; $impt = $_GET['impt']; echo $nextsch; echo "<br>"; echo $cerll; echo "<br>"; echo $ta; echo "<br>"; echo $impt;
php Syntax (Toggle Plain Text)
<?php print_r($_POST); ?> <html> <head> <script type="text/javascript"> function save() { document.getElementById("schdate").value = document.getElementById('nextsch').value; alert ("date"+document.getElementById('schdate').value); //when i alert it had value } </script> </head> <form name="mainform" method="post" action="1.php?impt=<?= $impt ?>"> <table> <tr> <td align='center' width='100'> <input type='text' id='nextsch' name='nextsch'> </td> <input type=hidden name=schdate id=schdate> </tr></table> <input type="submit" value="Save" name="Save" tabindex="7" style="font-size: xx-small" onclick="save();"> </form> </body> </html>
•
•
•
•
var imp = document.getElementById('yesno').checked;
Remove value='null'.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
Similar Threads
- Tutorials for Linux (*nix Software)
Other Threads in the PHP Forum
- Previous Thread: javascript help
- Next Thread: Sending HTML/Plain text Emails
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date development directory display download dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parse parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql structure syntax system table thesishelp tutorial update upload url validation validator variable video web xml youtube






