How to get many data from one form
| From: | Kalpin Erlangga Silaen | Date: | Mon, 13 May 2002 07:18:45 +0000 |
| Subject: | How to get many data from one form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-97329@lists.php.net to get a copy of this message | ||
Hello, i got problem while i try to get many data and same variable with
one form.
Below my source code
cobain.php (Form For User)
<html>
<head><title></title></head>
<body>
<PRE>
<?
print ("<FORM ACTION=\"coba.php\" METHOD=POST>\n");
print ("Nomor CD :<INPUT TYPE=text NAME=\"idD\"><BR>\n");
print ("<INPUT TYPE=SUBMIT NAME=\"Submit\"
VALUE=\"Kirim!\"></FORM>\n");
?>
</PRE>
</body>
</html>
And i want get data from idD not just one data, but 10 in one submit.
And below my coba.php
<html>
<head><title> Konfirmasi </title></head>
<body>
<PRE>
<?
$link = mysql_connect("localhost", "kalpin", "") or die("Could
not
connect");
echo ("Connected successfully \n");
mysql_select_db("test_latih_CD") or die ("Cannot Selected Data");
$counter = count($idD);
echo $counter;
$check ="SELECT id FROM CD WHERE id = '$idD' AND idO = '$idO'";
$q = mysql_query($check);
if (mysql_num_rows ($q))
{
$x = mysql_fetch_array($q);
echo ("Your Data has been exist with id = ". $x["id"]);
} else
{
$insert = "INSERT INTO CD values ('$idD')";
$result = mysql_query($insert)
or die("insert failed");
echo ("Your Data has been added");
}
mysql_close($link);
?>
</PRE>
</body>
</html>
Thank You
--
Kalpin Erlangga Silaen
Kalpin is kalpin@phreaker.net
Kalpin is using i.am.not.a.staff.of.dal.net
Kalpin has idle EVER and AFTER
Kalpin is not a irc warrior
http://www.geocities.com/kalpinus
Kalpin is away : Ready or Not, He will come