thelee Posted November 24, 2012 Share Posted November 24, 2012 can someone help me.the username box can show the session username.how i can auto fill the address part ? i use this code but got error at the address form. here is the code <?php error_reporting(E_ALL); session_start(); if(!isset($_SESSION['MM_Username'])) { echo "You are not logged in or registered / Click <a href='login.php'>Here</a> to login !"; } else { ?> <style type="text/css"> <!-- body { background:#000; background-attachment:fixed; background-repeat:no-repeat; color:#fff; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; } table { background:#000; border:1px solid white;} --> </style> </head> <body> <p><b>Welcome <?PHP echo $_SESSION['MM_Username']; ?> !</b></p> <form name="form1" method="post" action="order_product_process.php"> <p align="center" class="style10"> </p> <p align="center" class="style10"> </p> <p align="center" class="style10"> </p> <p align="center" class="style10"> </p> <p align="center" class="style10">Order Form:</p> <div align="center"> <table width="500" > <tr> <td width="239">Username</td> <td width="249"> <input name="username" type="text" id="username" value="<?PHP echo $_SESSION['MM_Username']; ?>" readonly="true"></td> </tr> <tr> <td>Address</td> <td><textarea name="address" id="address" value="<?PHP echo $_SESSION['MM_address']; ?>></textarea></td> <td><input type="submit" name="Submit" value="Order"> <input name="Reset" type="reset" id="Reset" value="Reset"></td> </tr> </table> </div> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </form> </body> </html> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/271100-auto-fill-form-based-on-session-login/ Share on other sites More sharing options...
50r Posted November 24, 2012 Share Posted November 24, 2012 did you set the $_SESSION['MM_address'] on the login page or where ever you set your sessions? Link to comment https://forums.phpfreaks.com/topic/271100-auto-fill-form-based-on-session-login/#findComment-1394765 Share on other sites More sharing options...
MDCode Posted November 25, 2012 Share Posted November 25, 2012 <td><textarea name="address" id="address" value="<?PHP echo $_SESSION['MM_address']; ?>></textarea></td> You are missing the end quote for value= Link to comment https://forums.phpfreaks.com/topic/271100-auto-fill-form-based-on-session-login/#findComment-1394894 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.