Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

PHP-MYSQL-HTML

Posted on 2007-10-17
8
Medium Priority
?
300 Views
Last Modified: 2012-05-05
Hi all.
I want to build a simple html form with the followings:
- Select Product :(look up field. get data from database product table)
- Expire Date:
- Delivery Date:
- Select Supplier:(look up field. get data from database supplier table)
- Quantity:
- Select State:(between Stock-In or Stock-Out)
but, viewed in a browser, it looks a bit messy.

can someone help please?
0
Comment
Question by:evry2004
  • 4
  • 4
8 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20092042
Are you able to post the code you have at the moment?
0
 

Author Comment

by:evry2004
ID: 20092052
sorry forgot it.
here they are:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Delicious Ltd | Product Registration</title>
<link href="delicious/titre.css" rel="stylesheet" type="text/css" />
<link href="delicious/label.css" rel="stylesheet" type="text/css" />
</head>

<body>

<?php

      $useriddb = "root";
            $passworddb = "";
     
      // Connecting to and selecting a database
      $connect = mysql_connect('localhost', $useriddb, $passworddb)
         or die('Could not connect: ' . mysql_error());
      //echo '<b>Step 1:</b> Connected successfully! <BR>';
     
      $db = 'db_delicious'; // My database is called test
      mysql_select_db($db) or die('Could not select database ('.$db.') because of : '.mysql_error());
      //echo '<b>Step 2:</b> Connected to ('.$db.') successful!<BR>';
     

// create a look up field  for product name

$sql1="      SELECT item_id, name from product";
$sql2="      SELECT supplier_name from supplier";

echo"<form method=post action=\"\" >";
?>


<center>
<table width="500" border="1" cellpadding="0" cellspacing="0" >
  <tr>
    <td align="center"><table width="450" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="150" rowspan="3"><img src="images/login.jpg" alt="image" width="149" height="399" /></td>
        <td width="300"><img src="images/delicious.jpg" alt="image" width="299
            " height="113" /></td>
      </tr>
      <tr>
        <td width="300" height="49"><h3 align="center" class="titre"> Stock Registration </h3></td>
      </tr>
      <tr>
        <td width="300" align="left" valign="top">
            <form name="product" method="post" action="delicious/productionn.php">
            <table width="300" border="">
  <tr>
    <td>Select Product:</td>
    <td>
      <?php
      echo" <select name=\"name\" >";
$result1=mysql_query($sql1, $connect);

while($row=mysql_fetch_array($result1)){

$item_id=$row["item_id"];
$name=$row["name"];

echo"<option value=\"$item_id\">$name";
}

echo"<\select>";
      ?>
      </td>
  </tr>
  <tr>
    <td>Expire Date:</td>
    <td><?php echo" <input name=\"exp_date\" type=\"text\" /> "; ?></td>
  </tr>
  <tr>
    <td>Delivery Date:</td>
    <td><?php echo" <input name=\"del_date\" type=\"text\" /> "; ?></td>
  </tr>
  <tr>
    <td>Select Supplier:</td>
    <td>
      <?php
      // create supplier look-up field

echo" <select name=\"supplier_name\" >";
$result2=mysql_query($sql2, $connect);

while($row=mysql_fetch_array($result2)){

$supplier_name=$row["supplier_name"];

echo"<option >$supplier_name";
}

echo"<\select>";
      
       ?>
       </td>
  </tr>
  <tr>
    <td>Quantity:</td>
    <td><?php echo" <input name=\"quantity\" type=\"text\" /> "; ?></td>
  </tr>
  <tr>
    <td>Select State:</td>
    <td>
      <?php
      // create state look-up field

echo"<input type=\"text\" name=\"state\">" ;

echo"<option >Stock-In";
echo"<option >Stock-Out";
      ?>
      </td>
  </tr>
 
  <tr>

    <td><input name="submit" type="submit" value="SUBMIT" /></td>
      <td><input name="reset" type="reset" value="RESET" /></td>
  </tr>
 
 
</table>

        </form>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</center>
</body>
</html>


0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20092107
So what exactly do you want to change? Which bit looks messy?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:evry2004
ID: 20092123
from the input "select Supplier" til the end,
it doesnt display correctly in the browser as if I had forgotten to put "<br>" somewhere.

Also I have the "</select>" appearing in both my look up fields.
just try to display in browser and you see the display.
thanks
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 1500 total points
ID: 20092183
ahh I think you forgot to close the options tag?

echo"<option >$supplier_name";

change to:

echo"<option >$supplier_name</option>";

Let me know how you go.
0
 

Author Comment

by:evry2004
ID: 20092300
the look up fields were sorted, but this part is still messy.
the tag need sorting.
here is the part:

<tr>
    <td>Select State:</td>
    <td>
      <?php
      // create state look-up field
echo" <select name=\"state\" >";
echo"<input type=\"text\" name=\"state\">" ;

echo"<option >Stock-In</option>";
echo"<option >Stock-Out</option>";
echo"<\select>";
      ?>
      </td>
  </tr>
0
 

Author Comment

by:evry2004
ID: 20092493
<tr>
    <td>Select State:</td>
In the following tag

    <td>    
 <?php
      // create state look-up field
echo" <select name=\"state\" >";
echo"<input type=\"text\" name=\"state\">" ;

echo"<option >Stock-In</option>";
echo"<option >Stock-Out</option>";
echo"<\select>";
      ?>
      </td>
  </tr>

I got ride of the following code:
echo"<input type=\"text\" name=\"state\">" ;
and its all fine. thanks a lot for your contribution as I was too tired to spot that.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20095369
Glad to be of assistance :)
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question