Jump to content

Echo A Form


thelee

Recommended Posts

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>

Link to comment
Share on other sites

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 by Jessica
Link to comment
Share on other sites

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 by AyKay47
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.