Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic form question.
#1
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.
Reply
#2
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.

Reply
#3
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PHP email input form - having trouble getting the form to work... abayindi 4 2,409 03-19-2012, 10:02 AM
Last Post: RainbowDashFTW
  [NEED HELP] PHP Form post, get, echo Đενɨаηсε™ 5 1,814 02-06-2012, 01:16 PM
Last Post: ★Cooldude★
  How to make a form. HB Virus 10 3,101 12-30-2011, 08:03 PM
Last Post: BreShiE
  PHP form creator? Sam 7 2,304 07-13-2011, 04:53 AM
Last Post: Skyset
  [SOLVED] HTML Form + PHP Help! J4P4NM4N 1 984 04-11-2011, 06:04 AM
Last Post: J4P4NM4N

Forum Jump:


Users browsing this thread: 1 Guest(s)