Jump to content

Dynamic page problem


esoteric

Recommended Posts

I cannot understand the problem with this script, im trying to have a invoice page that is updated with the information from my sql table depending on what the user types into a little form.

 

My http form is just;

<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="52%" align="center">Order Number</td>
                          <td width="48%"><input name="order" type="text" id="order" size="20" /></td>
                        </tr>
                        <tr>
                          <td><p> </p></td>
                          <td><p>
                              <input name="button" type="submit" id="button" value="Submit" />
                            </p></td>
                        </tr>
                      </table>

 

My php page is;

<?php include 'dbc.php'; page_protect();?>
<?php

$order 	= $_POST['order'];

mysql_connect("xxx", "xxx", "xxx") or die( "Unable to connect to database");
mysql_select_db("membership") or die( "Unable to select database");
$result = mysql_query("SELECT * FROM orderTable WHERE orderNum = '$order'");

$username 	= "test";
$password 	= "test";

if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {

?>
<h1>Login</h1>

<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <p><label for="txtUsername">Username:</label>
    <br /><input type="text" title="Enter your Username" name="txtUsername" /></p>
    <p><label for="txtpassword">Password:</label>
    <br /><input type="password" title="Enter your password" name="txtPassword" /></p>
    <p><input type="submit" name="Submit" value="Login" /></p>
</form>

<?php
}
else {
?>



<table width="50%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="29%">First Name</td>
    <td width="71%"><?php echo $result['firstName']; ?></td>
  </tr>
  <tr>
    <td>Lastname</td>
    <td><?php echo $result['lastName']; ?></td>
  </tr>
    <tr>
    <td>Order Number</td>
    <td><?php echo $result['orderNum']; ?></td>
  </tr>
    <tr>
    <td>Order Date</td>
    <td><?php echo $result['orderDate']; ?></td>
  </tr>
    <tr>
    <td>Order</td>
    <td><?php echo $result['strMessageBody']; ?></td>
  </tr>
    <tr>
    <td>Total</td>
    <td><?php echo $result['total']; ?></td>
  </tr>
  
</table>


<?php
}
?> 

 

It just doesn't display anything! Any help is much appreciated.

Thank you.

 

 

Link to comment
Share on other sites

  • 3 months later...

Please, Follow These three step and solve your error:

 

- You can make empty files named index.php, page1.php, page2.php, page3.php. Now add content.

- index.php - this file contains alone the layout. The agreeable space is empty. Remember, this is an absolute html file, which use it compulsory to basic HTML structure(<html> <head> </head> <body> </body> </html>) and what comes in between.

- page1.php, page2.php, page3.php - these 3 files contain only the content. No layout. Just throw on some headings, paragraphs of text and images here.

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.