Jump to content

Recommended Posts

Hi,

i have a text box with a default value of null.

There is a particular button i have that once you press it, it populates a select menu with data from a database.
when a user selects a particular item in the select menu i wish to set the textbox value to "some string".

i can use the $_POST array superglobal to to retrevie the information i need, but how do i set it ?
Link to comment
https://forums.phpfreaks.com/topic/11295-set-values-for-a-element-solved/
Share on other sites

i get a error [quote]Parse error: syntax error, unexpected T_VARIABLE in /var/www/html/php/news_adder.php on line 32[/quote]

heres line 32

[code]<input type="text" name="title" value="<?php$_POST['title_value'] ?>"/>[/code]

also why do you have a "=" sign before the "$" sign when i do that i get a syntax error.
putting the "echo" statment made it work - thanks alot for the quick reply and solution!

can believe i didnt think of it.

Just curious tho is that the only way to do it? what is the recomended way? all the books i have simply retrive values from forms. the only ones where they set values are for select menus.
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.