Page 1 of 1

NEED HELP! URGENT!

Posted: Sun May 31, 2009 3:35 am
by angelalala
Can anyone guide me on how to code the following using PHP?

I wanted to create a "Purchaseorder.php" just like the URL below.

http://frontaccounting.com/acc3/purchas ... wOrder=Yes

Where after I've selected the items and clicked on the "AddItem" button, another row of the table will appear for me to select again.

How can I code this?

please help me. :(

Re: NEED HELP! URGENT!

Posted: Sun May 31, 2009 4:14 am
by iFlex
Its hard to pinpoint the problem without the source code, could you post it maybee?

Re: NEED HELP! URGENT!

Posted: Sun May 31, 2009 4:52 am
by angelalala

Code: Select all

 
<form method="POST" action="test3.php">
<table>
<table border ='1' style='border: groove' cellpadding = '10' cellspacing='2' style='table-layout:auto' width ='700px' height= '50px'>
<th><font size= 6px> Order Item</font></th>
<tr>
   <td>Select item : </td>
   <td><select name="item">
   <option>Paper</option>
   <option>Plastics</option>
   <option>Wood</option>
   </select>
   </td>
</tr>
</tr>
    <td> Quantity</td>
    <td><input type="text" name="itemquantity" value=""></td>
</tr>
<tr></tr>
<tr>
    <td colspan="2"><input type="submit" name="Submit" value="Add"></td>
</tr>
<table>
</form>
 
<?php
// get the values from the 1st form
$item = $_POST['item'];
$itemquantity = $_POST['itemquantity'];
 
?>
<form>
<table>
<table border ='1' style='border: groove' cellpadding = '10' cellspacing='2' style='table-layout:auto' width ='700px' height= '50px'>
<tr><th>ID</th>
    <th>Item Name</th>  
</tr>
<td><?php  echo $item   ?></td>
<td><?php echo $itemquantity ?> </td>
    
</form> 
 
Above is what I've coded. What I really wanted is, after clicked on the " ADD" button, I can view what I've added. Therefore, I added one more table to view the results. Now the problem is, I can view one result only . How can it be coded so that after i added the 1st item, and i can see the result, i can carry on add the others items and the rows of the results will increase as well?

Or is there a easier way for me to achieve that?

http://frontaccounting.com/acc3/purchas ... wOrder=Yes ( the result i want is the same in<<<)

Thanks!

Re: NEED HELP! URGENT!

Posted: Sun May 31, 2009 5:24 am
by iFlex
I think so but this area is not my strong spot so ill take a look and modify that code for you. Also when you post code dont forget to set it as code ;)

Re: NEED HELP! URGENT!

Posted: Sun May 31, 2009 5:26 am
by angelalala
thanks :)

Re: NEED HELP! URGENT!

Posted: Sun May 31, 2009 5:47 am
by iFlex
Heres what I got so far.

Its not working yet but its just one single file called cart.php

Code: Select all

<form>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table>
<table border ='1' style='border: groove' cellpadding = '10' cellspacing='2' style='table-layout:auto' width ='700px' height= '50px'>
<th><font size= 6px> Order Item</font></th>
<tr>
<td>Select item : </td>
<td><select name="item">
<option>Paper</option>
<option>Plastics</option>
<option>Wood</option>
</select>
</td>
</tr>
</tr>
<td> Quantity</td>
<td><input type="text" name="itemquantity" value=""></td>
</tr>
<tr></tr>
<tr>
<td colspan="2"><input type="submit" name="Submit" value="Add"></td>
</tr>
<table>
</form>
 
<?
if (!isset($_POST['submit']))
// get the values from the 1st form
$item = $_POST['item'];
$itemquantity = $_POST['itemquantity'];
 
?>
<form>
<table>
<table border ='1' style='border: groove' cellpadding = '10' cellspacing='2' style='table-layout:auto' width ='700px' height= '50px'>
<tr><th>ID</th>
<th>Item Name</th>
</tr>
<td><?php echo $item ?></td>
<td><?php echo $itemquantity ?> </td>
 
</form>