Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.