thelee Posted November 13, 2012 Share Posted November 13, 2012 i want to make a order form but it is only for those who logged in. but i didnt show the form. i might do some mistake,can someone help me ? here is the code <?php session_start(); if(isset($_SESSION['MM_Username'])) { $MM_Username = $_SESSION['MM_Username']; echo "<body> <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="249" border="1" bgcolor="#000000"> <tr> <td width="54"><span class="style1">Name</span></td> <td width="179"><input name="name" type="text" id="name" maxlength="30" value="<?php echo $MM_Username; ?>"></td> </tr> <tr> <td><span class="style4">Address</span></td> <td><textarea name="address" id="address"></textarea> </td> </tr> <tr> <td><span class="style1">Phone</span></td> <td><input name="phone" type="text" id="phone" maxlength="30"></td> </tr> <tr> <td><span class="style9">IC Number </span></td> <td><input name="ic" type="text" id="ic" maxlength="30"></td> </tr> <tr> <td><span class="style8">Product Name </span></td> <td><input name="product_name" type="text" id="product_name" maxlength="30"></td> </tr> <tr> <td><span class="style1">Quantity</span></td> <td> <input name="quantity" type="text" id="quantity" maxlength="30"></td> </tr> <tr> <td> </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>"; } else { $MM_Username = ''; echo "why you dont register?"; } ?> <style type="text/css"> body {background-attachment:fixed} body {background-repeat:no-repeat} --> </style> </head> </html> Quote Link to comment Share on other sites More sharing options...
Jessica Posted November 13, 2012 Share Posted November 13, 2012 (edited) Turn on error reporting - you have multiple syntax errors. You need to escape the quotes within your strings. For a large block like this you should probably use HEREDOC syntax. You also are trying to use PHP outside of your PHP tags, if I'm reading your code right. Edited November 13, 2012 by Jessica Quote Link to comment Share on other sites More sharing options...
thelee Posted November 13, 2012 Author Share Posted November 13, 2012 oh sorry.im still new with php. never heard about the heredoc. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted November 13, 2012 Share Posted November 13, 2012 (edited) either heredoc or end php parsing with a closing ?> tag and begin php parsing after the form. Also, instead of using so many <p> </p>, apply some CSS to the form and use a margin Edit: Also in this line: <input name="name" type="text" id="name" maxlength="30" value="<?php echo $MM_Username; ?>"> php tags are only needed if you are not already parsing php, which in this case you are. Edited November 13, 2012 by AyKay47 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.