1
2
3 --------------------------------------------------
4 Create file adds.php in to "natures" folder
5 --------------------------------------------------
6
7
8 copy the script below to adds.php
9 --------------------------------------------------
10
11
12 < ?php 13 $db_hname = "localhost"; 14 $db_uname = "root"; 15 $db_pword = ""; 16 $db_name = "eod"; 17 $link = mysql_connect($db_hname, $db_uname, $db_pword) or die("Not Success ....!"); 18 if (!$link) { die('Could not connect: ' . mysql_error()); } 19 mysql_select_db($db_name); 20 $ts_p = mysql_query("SELECT * FROM tbskategori WHERE usview = 1"); 21 $rts_p = mysql_num_rows($ts_p); 22 ? >
23
24 < form name = 'frm_add' method = 'POST' action =''>
25 Product Category : < select name='slid '>
26 < ? php 27 for ($i=1;$i< = $rts_p;$i++){ 28 $dts_p = mysql_fetch_array($ts_p); 29 ? >
30 < option value =< ? php echo $dts_p['usid'].$dts_p['ukid'];? > >
31 < ? php echo $dts_p['usid'].strtoupper ($dts_p['ukid']).'-'.strtoupper ($dts_p['uskategori']);?>< /option >
32 < ? php 33 } 34 ? >
35 < /select >< p >
36
37 Product Name : < input name= 'txt_pn' type=text size='15' value='' style='border-style:solid; border-width:1; font-family: Arial; font-size: 8pt; height:20px; width:8pc;border-color:#808080;padding-left:2px;' >< p >
38 Product Price :< input name= 'txt_pp' type=text size='15' value='' style='border-style:solid; border-width:1; font-family: Arial; font-size: 8pt; height:20px; width:8pc;border-color:#808080;padding-left:2px;' >< p >
39 Product Specification :< input name= 'txt_ps' type=text size='15' value='' style='border-style:solid; border-width:1; font-family: Arial; font-size: 8pt; height:20px; width:8pc;border-color:#808080;padding-left:2px;' >< p >
40 < input name= 'btn_add' type = 'submit' value='Add New Item' style='border-style:solid; border-width:1; font-family: Arial; font-size: 11px; height:20px; width:6pc;border-color:#808080;text-align: center; vertical-align:top;' >
41 < /form >
42 < ? php 43 if($_POST['btn_se']){ 44 INSERT INTO `eod`.`tbproduk` (`idp`, `kprod`, `nprod`, `hprod`, `sprod`) 45 VALUES (NULL, $_POST['slid'], $_POST['txt_pn'], $_POST['txt_pp'], $_POST['txt_ps']); 46 ? >
47 < SCRIPT language="JavaScript" >
48 < ! -- 49 window.location="adds.php"; 50 -- >
51 < /SCRIPT >
52 < ? php 53 } 54 55 ? >
No comments:
Post a Comment