|
|
|
ช่วยแก้แบบฟรอมการส่งข้อมูลจาก list/menu ไปยังฐาน SQLให้หน่อยคับ |
|
|
|
|
|
|
|
ช่วยแก้แบบฟรอมการส่งข้อมูลจาก list/menu ไปยังฐาน SQLให้หน่อยคับ
Code (PHP)
<html>
<head>
<?php
if(isset(form1)) {
$string1=$_POST["no.1"],$string13=$_POST["no.13"],
$string2=$_POST["no.2"],$string14=$_POST["no.14"],
$string3=$_POST["no.3"],$string15=$_POST["no.15"],
$string4=$_POST["no.4"],$string16=$_POST["no.16"],
$string5=$_POST["no.5"],$string17=$_POST["no.17"],
$string6=$_POST["no.6"],$string18=$_POST["no.18"],
$string7=$_POST["no.7"],$string19=$_POST["no.19"],
$string8=$_POST["no.8"],$string20=$_POST["no.20"],
$string9=$_POST["no.9"],$string21=$_POST["no.21"],
$string10=$_POST["no.10"],$string22=$_POST["no.22"],
$string11=$_POST["no.11"],$string23=$_POST["no.23"],
$string12=$_POST["no.12"],$string24=$_POST["no.24"],
$objConnect = mysql_connect("localhost","root","test") or die("Error Connect to Database");
$objDB = mysql_select_db("test");
$strSQL = "INSERT INTO status";
mysql_close($objConnect);
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>
<style type="text/css">
<!--
.style1 { color: #006600;
font-weight: bold;
}
.style2 { color: #0000FF;
font-weight: bold;
}
.style3 { color: #FF0000;
font-weight: bold;
}
body {
background-image: url(images/or13.jpg);
}
-->
</style>
</head>
<body>
<!----- <form action="phpMySQLAddSave.php" name="frmAdd" method="post"> -->
<div align="center">
<p> </p>
<form id="form1" name="form1" method="post" action="">
</form>
<table width="297" height="423" border="1" cellpadding="0" cellspacing="0">
<col width="35" />
<col width="145" />
<col width="77" span="8" />
<col width="75" span="6" />
<col width="64" />
<tr height="34">
<td width="69" height="34" bgcolor="#99FF99"><div align="center"><strong>Number Of</strong></div></td>
<td colspan="2" bgcolor="#FFFF00"><div align="center"><a name="RANGE!B2:P22" id="RANGE!B2:P22">STATUS Nitrogen tank start shift</a></div></td>
</tr>
<tr height="26">
<td height="26" bgcolor="#99FF99"><div align="center"><strong>Nitrogen tank</strong></div></td>
<td width="107"><div align="center"><strong>Day</strong></div></td>
<td width="121"><div align="center"><strong>Night</strong></div></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.1</strong></div></td>
<td width="107" height="24"><select name="no.1">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.13">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.2</strong></div></td>
<td><select name="no.2">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.14">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.3</strong></div></td>
<td><select name="no.3">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.15">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.4</strong></div></td>
<td><select name="no.4">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="on.16">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.5</strong></div></td>
<td><select name="no.5">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="on.17">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.6</strong></div></td>
<td><select name="no.6">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.18">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.7</strong></div></td>
<td><select name="no.7">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.19">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.8</strong></div></td>
<td><select name="no.8">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.20">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="36">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.9</strong></div></td>
<td><select name="no.9">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.21">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.10</strong></div></td>
<td><select name="no.10">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.22">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="24" bgcolor="#99FF99"><div align="center"><strong>No.11</strong></div></td>
<td><select name="no.11">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.23">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="28" bgcolor="#99FF99"><div align="center"><strong>No.12</strong></div></td>
<td><select name="no.12">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
<td><select name="no.24">
<option value="80">----------------</option>
<option value="81">Used</option>
<option value="82">Spare</option>
<option value="83">Empty</option>
<option value="84">Tank Damage</option>
</select></td>
</tr>
<tr height="33">
<td height="69" colspan="3" bgcolor="#99FF99"><div align="center">
<form>
<label>
<input name="frome1" type="submit" value="save">
<br />
</label>
<input type=button value="reset" onClick="javascript:location.reload();">
</form>
</div></td>
</tr>
</table>
<form id="form3" name="form3" method="post" action="">
</form>
<p> </p>
<p> </p>
</div>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p> </p>
</body>
</html>
</body>
</html>
Tag : PHP, CakePHP
|
|
|
|
|
|
Date :
2011-04-26 16:00:39 |
By :
sambeem001 |
View :
976 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันก็อ่านจาก $_POST ปกติครับ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "INSERT INTO customer ";
$strSQL .="(CustomerID,Name,Email,CountryCode,Budget,Used) ";
$strSQL .="VALUES ";
$strSQL .="('".$_POST["txtCustomerID"]."','".$_POST["txtName"]."','".$_POST["txtEmail"]."' ";
$strSQL .=",'".$_POST["txtCountryCode"]."','".$_POST["txtBudget"]."','".$_POST["txtUsed"]."') ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "Save Done.";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close($objConnect);
?>
</body>
</html>
Go to : PHP MySQL Add/Insert Record
|
|
|
|
|
Date :
2011-04-26 16:06:01 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันติดต่อ sqlไม่ได้อะ
|
|
|
|
|
Date :
2011-04-26 16:09:31 |
By :
sambeem001 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|