Page 1 of 1

php Forms

Posted: Wed Jul 26, 2006 10:06 am
by crai8088
HI There,

I am trying to create a html based form that works with a mysql database and intergrates with my phpbb2 forum. What i cant figure out is how to get the username auto filled.

Basically i would like it so that once the page is loaded the username is recognised and auto filled or they are redirected to a log in page?

Any help would be appreciated?

Posted: Wed Jul 26, 2006 10:09 am
by feyd
There is a fairly common startup code that all the phpbb pages run. Use it, and you should have access to the user data.

Posted: Wed Jul 26, 2006 10:12 am
by crai8088
Yes i have access to the user tables.

However what i cant figure out is what to use to auto fill the Username Field?

<form name="form2" method="post" action="">
<input name="textfield" type="text" value="$username">
</form>

that is what i have at the moment however the $username is not auto filling i know this code is wrong any ideas how to fix it?

Posted: Wed Jul 26, 2006 10:13 am
by feyd
The startup code creates an array $userdata.

Posted: Wed Jul 26, 2006 5:32 pm
by crai8088
Well i finally got the auto fill to work Thanks

Could you be kind enough to help me with this next bit?

The form is working fine now and inserting the data into a table now i want it to remeber this data and autofill in the fields that a person has previously filled in when the revist the form.
$BYB_ID = $userdata['username'];
$DOYLES = $byb_players['DOYLES']
The $BYB_ID works fine this is the username that is autofilling the second one is not working this is in a different table than the 1st. I think i need to set up an array for this but am not sure does anybody know how to do it?

Thanks