Support Forums

Full Version: Basic form question.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So this I got a basic login form on my index.php, and normally you would see two input boxes right ? Now, my question is how do I put a text in the input boxes when the page loads up. I tried echoing but it didn't work for me or I might did it wrong.

PHP Code:
<form action='index2.php' method='POST'>
<
input type='text' name='username'></br>
<
input type='password' name='password'></br>
<
input type='submit' value='Submit'></br>
</
form

Here is an example I made how I wanted it to show up.
[Image: vy84k0.png]

Thanks.
PHP Code:
<input type="text" name="username" value="User" />
// or within php
echo "<input type=\"text\" name=\"username\" value=\"{$some_var}\" />"

The attribute value defines what will be in there.

(03-06-2011, 11:47 AM)Gaijin Wrote: [ -> ]
PHP Code:
<input type="text" name="username" value="User" />
// or within php
echo "<input type=\"text\" name=\"username\" value=\"{$some_var}\" />"

The attribute value defines what will be in there.

Oh thanks, that worked. I did that before and it didn't work, but now it does. Oh well, silly me.