Jump to content

[SOLVED] Getting value of textfield


jdadwilson

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/50297-solved-getting-value-of-textfield/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.