PHP - Moved: Need Help Getting Hidden Input Dynamic Value
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=342456.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317004.0 Hi Guys, Appreciate any help here please... Basically I want to hide some inputs on my registration page and populate them will default values. Everything works okay, apart from the input below: Code: [Select] <input type="hidden" name="seek_location" value="Anywhere"> When I use the above, the MYSQL database field for seek_location is left empty... I've noticed that the code below pulls the location into a dropdown list. You know the kind of thing, Australia, UK, USA etc etc: Code: [Select] $seek_location = $wcr[$seek_location]; Code: [Select] <? $p=0;asort($wcr);reset($wcr); while (list ($p, $val) = each ($wcr)) { echo '<option value="'.$p.'">'.$val; } ?> So, all I want to do is have: Code: [Select] <input type="hidden" name="seek_location" value="Anywhere"> Populate seek_location with Anywhere Any help appreciated Thanks Rob i have the following code: <li>Have you read the <?php echo link_to('FAQ','util/faq') ?> ? <select id="yesnolist" onChange="getChoice(this.value)"> <option value="yes" selected="selected">Yes</option> <option value="no">No</option> </select> </li> <input type="hidden" name="text" size=30 id="yesandno"> <?php if ($_GET['yesandno'] == "no") { echo "anything!!!!!!!!!!!!!!!!!!!"; } ?> then my java script for getCoice(): function getChoice(val) { yesNo = new Array("Yes", "No"); var getsel = document.contactus.yesnolist.value; var e = document.getElementById("yesnolist"); var strUser = e.options[e.selectedIndex].value; document.contactus.yesandno.value = strUser; alert(document.contactus.yesandno.value); return strUser; } my alert will gove yes or no depending on what i chose in the dropdown but HOWCOME it does not go into the if ($_GET['yesandno'] == "no") ???? please help??? hidden input field type doesnt display the full value i get from table, say if it is a first name and last name i get only the first name. here is my input field echo "<input type=hidden name=proid value=$result_row[project_id]></include>"; echo "<input type=text value=$result_row[project_name] readonly></include>"; my sql query returns the full name but when i input into the text field it returns an incomplete project name like say if it is fans of soccer, i just get the value "fans" in my display..... I am trying to set the hidden input in the javascript but it doesn't set it in the php. This is the form with the hidden input. It corresponds to a field in the database table with the name of draggables. <form method="post" accept-charset="utf-8" id="myForm2" action="/mealplans/add"> <input type="hidden" name="draggables" id="drag12"/> <button id="myId" type="submit">Submit Form</button> </form> This is where I change the value in the javascript: if(data == "draggable3"){ alert("data " + data); var x = document.getElementById("drag12").value; x = "draggable3"; alert(x); } //end if
I've also tried getElementsByName but that didn't work either. var y = document.getElementsByName("draggables").value; //only changes it on the client This is actually a cakephp site but this problem is with the PHP so I am publishing it here. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333152.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=306771.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=351100.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=333014.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=321416.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342341.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357949.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=357806.0 Great conversation, wrong board. This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=357967.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=307486.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=330084.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=352987.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=306489.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=344655.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=349729.0 |