Concatenate input values html/php

cedricdeer

New Member
I've made a custom login page for a phpbb forum. Currently the user inputs a "username" and a "password." Since the majority of my users are dumb as a rock, I changed the "username" input box into two "firstName" and "lastName" input boxes. What I have so far [this is a .php file]:\[code\]<form action="./ucp.php?mode=login" method="post"> <fieldset> <!-- my new input boxes --> <label for="username">First name:</label>&nbsp; <input type="text" name="firstname" id="firstname" size="10" title="Firstname" ><br><br> <label for="username">Last name:</label>&nbsp; <input type="text" name="lastname" id="lastname" size="10" title="Lastname" ><br><br> <!-- original input box; now hidden --> <label for="username">Username:</label>&nbsp; <input type="hidden" name="username" id="username" size="10" title="Username" /> <label for="password">Password:</label>&nbsp; <input type="password" name="password" id="password" size="10" title="Password" /> <br><label for="autologin">Log me on automatically each visit <input type="checkbox" name="autologin" id="autologin" /></label> <br><input type="submit" name="login" value="http://stackoverflow.com/questions/12795060/Login" /> </fieldset></form>\[/code\]I want to know how to how to concatenate the "firstname" and "lastname" fields to make a single "username" variable. There needs to be a space between the firstname and lastname, so it would appear "George Washington" instead of "GeorgeWashington." Concatenation happens before validation. I would prefer a solution that does not use javascript, although if there is no easy alternative, I guess I'll take one.
 
Back
Top