When I want to enter a text string in a text box from a variable (i.e. $name) only the first word in the text string appear. That happend when the http form syntax is applied inside a PHP tag. It does NOT happend when the form syntax is applied outside a PHP tag. This should not happend, should it?
The application I have fetched a mysql record with a number of text string variables and show it in a form with a table in text tags for modifications. But only the first word in the strings appear. In text area nothing is shown.
form value from variable
Moderator: General Moderators
Re: form value from variable
Example:
<?php
$a="this is a test";
echo '
<form name="form1" method="post" action="">
<label>a1
<input type="text" name="a1" id="a1" value='.$a.'>
</label>
</form>'; ?>
In this case only 'this' appair in the text box
<?php
$a="this is a test";
echo '
<form name="form1" method="post" action="">
<label>a1
<input type="text" name="a1" id="a1" value='.$a.'>
</label>
</form>'; ?>
In this case only 'this' appair in the text box
Re: form value from variable
<input type="text" name="a1" id="a1" value="'.$a.'">
replace input box code by above code
replace input box code by above code
Re: form value from variable
Dude, making duplicate accounts and asking the same question really doesn't make me want to help you..
I told you this in your other thread.
I told you this in your other thread.
Re: form value from variable
".$a" will only show .$a in the text box, and not the variable content.
You have to terminate the php echo string with a ' in order to display the $variable content. The " .." quotes will display the content between the marks as text string only.
You have to terminate the php echo string with a ' in order to display the $variable content. The " .." quotes will display the content between the marks as text string only.