By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,718 Members | 1,349 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,718 IT Pros & Developers. It's quick & easy.

handle multiple related form on one page, urgent

P: 17
i have a table that contains product details. i have a form with a textbox that takes product name as input. as soon as the submit button is clicked the product name as submitted has to be shown bellow the first form (in same page). everytime i click the submit button the product name as entered has to be shown below along with the previous product names.

i have done it for the first submit. i don't know how to append the product name after second submission and so on.

can you please suggest any way out or any code example.

thanks in advance.

fariba
Jan 29 '07 #1
Share this Question
Share on Google+
5 Replies


mmarif4u
P: 23
HI,,,

Can u please show the code.And reshape ur q with clearity..

Thanks.
Jan 29 '07 #2

P: 17
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="testInventory.php" method="post">
<input type="hidden" name="ctr" value="<?=$ctr;?>">
Search Product Info ! ! !<br><br>
Product Name <input type="text" name="pn" id="pn" value="<?=$pn; ?>">
<br><input name="submit" type="submit" id="submit" value="Submit">

</form>
<?php
if(isset($_POST['submit'])){

?>
<form action="testInventory.php" method="post">
<input type="hidden" name="pn" value="<?=$pn; ?>">
<?php
//echo "<br>success: ".$pn."/";

include 'connecttutorial.php';

$s="SELECT DISTINCT p_name FROM inv WHERE p_name LIKE '$pn%' order by p_name";
//echo "<br>s: ".$s;
$result = mysql_query($s);
$num_rows2 = mysql_num_rows($result);
//echo "<br>num_rows2: ".$num_rows2."/";

//$myrow2=mysql_fetch_row($result);
if($num_rows2!=0){
$hint="";
while($FetchSQL=mysql_fetch_array($result))
{?>
<input type="checkbox" name="s_net[]" value="<?=$FetchSQL["p_name"]; ?>" ><? echo $FetchSQL["p_name"]." ";
}
?>
<br><input name="submitn" type="submit" id="submitn" value="Submit">
</form>
<?php
}
else{
echo "<br>no suggestion";
}
}
?>
</body>
</html>
Jan 29 '07 #3

mmarif4u
P: 23
u r searching ur db, not inserting data...
ok so u want that all the data showed in one page...

Remove distinct from select statement then see what are the results...
Jan 29 '07 #4

P: 17
thanks for the suggestion but it won't make any difference.

what i need is for example:
i will enter pe and click submit. what i will see is: pen pencil (below the form).

next time i will enter sh and click submit. what i will see is: pen pencil sharpner(below the form).

the process will continue unless i get all my desired product names.

i hope you understand what i want. i want to append product name everytime i click submit. you may have noticed that i have included checkbox. it is because, after i am done with all the desired product name i will select checkbox (s) to view the product details of the checked products.

hope to get a quick and helpful reply.

thanks

fariba
Jan 29 '07 #5

mmarif4u
P: 23
The best way for this in my mind is to store ur data which u want to
display in the page to a temp table in the db,then display it from that
table,,,
For example:
Make new table with protemp,make fields which u want to display
,when u search one by one the data will comeout, with the stored one...

May be this will work,, i am not sure
u can try it...

Good Luck..
Jan 29 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.