jdadwilson Posted May 6, 2007 Share Posted May 6, 2007 How does one obtain the value of a text field for inclusion into a URL? I have a for with multiple link fields. From each link field I want to do different actions. One would be to add a record to a database another to edit the record and another to delete a record. The information for the query is contained in several text fields on the form. To pass the information to the action php file I am build the URL with the necessary information. So my question is how does one obtain the value of the text box for inclusion into the URL. My test code is as follows: <a name="buttonAdd" href="doMgmtAdd.php?action=add&recordID=0&Date=<?php echo dateTextfield.value; ?>"></a> Doing this only appends the text "dateTextfieldvalue" (note no period) to the URL, and causes the sql INSERT to enter a date of "0000-00-00". If I do the following: <a name="buttonAdd" href="doMgmtAdd.php?action=add&recordID=0&Date=<?php echo '2007-05-06'; ?>"></a> a valid record gets added. Any suggestions. TIA Quote Link to comment https://forums.phpfreaks.com/topic/50297-solved-getting-value-of-textfield/ Share on other sites More sharing options...
clown[NOR] Posted May 6, 2007 Share Posted May 6, 2007 change dateTextfield.value to $_REQUEST['textfieldname'] Quote Link to comment https://forums.phpfreaks.com/topic/50297-solved-getting-value-of-textfield/#findComment-246889 Share on other sites More sharing options...
jdadwilson Posted May 7, 2007 Author Share Posted May 7, 2007 Didn't work. The action string is build in the calling page not in the called page. I need to build the URL in the calling page so that it can be parced by $_GET in the called page. Quote Link to comment https://forums.phpfreaks.com/topic/50297-solved-getting-value-of-textfield/#findComment-246902 Share on other sites More sharing options...
neel_basu Posted May 7, 2007 Share Posted May 7, 2007 Try $_GET['textfieldname'] or $_POST['textfieldname'] Quote Link to comment https://forums.phpfreaks.com/topic/50297-solved-getting-value-of-textfield/#findComment-247004 Share on other sites More sharing options...
chronister Posted May 7, 2007 Share Posted May 7, 2007 Take a look at the method of your form. If it is GET then you would obtain the value of the textfield like this I am assuming that your field name is dateTextfield $_GET['dateTextfield']; if it post then use $_POST['dateTextfield']; Note that it is CasE SenSiTive. If your field name is dateTextfield then the above should work, if it is datetextfield, then the above will fail. Quote Link to comment https://forums.phpfreaks.com/topic/50297-solved-getting-value-of-textfield/#findComment-247077 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.