PHP - Moved: How To Pass New Value To Hidden Input
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=317004.0 Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=342456.0 Code: [Select] <form action='test.php' method='post'> <input id="Username" type="hidden" name="date2" /> <input type="submit" name="action" value="Submit"></form> Hi I want to pass a Username javascript variable to test.php as hidden, anyone can help? When code this Code: [Select] <input id="Username" type="input" name="date2" />Data can pass to test.php When code this Code: [Select] <input id="Username" type="hidden" name="date2" />Data fail to pass over 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??? I have a page that has roughly 100 text input fields. Once the user is done, I need to put the data in my mysql db. How do I get the data from the user input page to the php page that will process the data (e.g. process.php)? I've done some searching and found a few possibilities use a ajax style call back to load a seperate asp page (e.g. createsession.asp) and that page set session variables that can then be read by process.php write everything to a cookie using some sort of a delimiter so that it can handle multiple variables (e.g. cookie data => var1/var2/var3/var4... write all the data to a text file and then have process.php load that file Which should I pursue? Is there a better option? 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 Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=353002.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=343031.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=357747.0 I work with a large codebase and I have this situation come up fairly often:
the legacy class has large objects such as:
$design->motor->dimensions->a; $design->motor->dimensions->bd; $design->specifications->weight; $design->data->height; //etcWhen I create a new class, that class sometimes operates on the specific data, so say: class MyClass { public function compute($weight, $height, $a) { //stuff } } //and I call this for example as such: (new MyClass())->compute($design->specifications->weight, $design->data->height, $design->motor->dimensions->a);CONS: Potential issue: if design specs change and I need to change things parameters in "compute" function, I need to "re-key" the variables I pass to the function, and adjust things accordinly in MyClass as wel. PROS: only the exact data is being passed, and this data can come from anywhere it is viable, so in effect the function is fairly well separated, I think. Alternative option for me is to pass the entire design object, i.e class MyClass { public function compute(&$design) //can also be done via DI through a setter or constructor. { print $design->specifications->weight; print ($design->data->height + $design->motor->dimensions->a); //stuff } } (new MyClass())->compute($design);PROS: In this case when things change internally in which variables are needed and how things are computed, I only need to change the code in compute function of the class itself. CONS: MyClass now needs to be aware of how $design object is constructed. When it comes to this parameter passing, and Dependency Injection like this in general, does Computer Science advocate a preference on this issue? Do I pass the entire object, or do I pass only the bits and pieces I need? I'm trying to get a simple table to display and am not sure how to make it happen. Table will have just 2 columns. A TIME and an EVENT. What I want to have happen is for the first row to show the TIME and next to that, the EVENT. If a TIME has more than one event going I want the next row to show an empty first cell and then the second event below the first. If I set up the loop the only way I know how (so far) it would also output the TIME value again and again as many times as there were events for that same time. For example what I don't want is: 9:15 Sunday School 9:15 Nursery Available What I do want is: 9:15 Sunday School Nursery Available Thanks. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=330084.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=347360.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=359179.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 JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=318062.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=357414.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319994.0 |