PHP Equivalent to .Net .text
Moderator: General Moderators
PHP Equivalent to .Net .text
I'm a newly .net to PHP convert. Its going great so far, much lighter than .net. In .net, you could use server side code to assign a value to a textbox by using txtName.Text = "value". I know I can pass my PHP variable into a session, then pick it up with Javascript, then use JavaScript to set the value. However, I was wondering if there was a simpler way of accessing form fields without client side JavaScript. Of course, thats why .net is so heavy because its more intuitive. Thanks for the help!
I'm not sure exactly what you're asking, but if you want to simply put a value into a regular text box you can do something like
or
I would be careful with statements like
Code: Select all
echo "<input type=\"text\" name=\"txtName\" value=\"$valueToInsert\" />";Code: Select all
echo "<textarea name=\"txtName\" rows=\"5\" columns=\"60\">$valueToInsert</textarea>\n";as its not entirely true and liable to start a flamewar. Its also the type of statement that could make some people not want to help you.Of course, thats why .net is so heavy because its more intuitive.
Last edited by nielsene on Fri Jul 22, 2005 10:23 pm, edited 1 time in total.
Nope, thats not what I'm looking for. I don't think PHP can do it as easily as .Net. Not trying to start a flame war, but I've been a .Net developer for 3 years and only been doing PHP for a couple of months...the advantages of PHP is starting to outway .Net. Don't forget...just 2 months ago I would have been preaching about the wonders of .Net.
I *think* I might know what you mean (whoa, grammar).
<form method="post">
<input type="textbox" name="whatever">
</form>
<form method="post">
<input type="textbox" name="whatever">
</form>
Code: Select all
echo $_POST['whatever'];