I'm having some grief trying to pass an array from a popUp form to MySql.
It's creating a new record but all entries are blank.
Any ideas?
Tia, Wil.
Code: Select all
<?
$action = ($_GET['action']);
// Set Up Submit
if ($_POST['submit']) {
echo '<pre>'; print_r($_POST); echo "<h1>Submitted to DB</h1><br>"; echo "</pre>";
}
// Add function
function fnAddFaceStock() {
html_header();
$description = $_GET['description'];
$basisWeight = $_GET['basisWeight'];
$wetTensileStrenghtCD = $_GET['wetTensileStrenghtCD'];
$wetTensileStrenghtMD = $_GET['wetTensileStrenghtMD'];
$dryTensileStrengthCD = $_GET['dryTensileStrengthCD'];
$dryTensileStrengthMD = $_GET['dryTensileStrengthMD'];
$sql_add = "INSERT INTO austock values('','$description','$basisWeight','','$wetTensileStrenghtCD',
'$wetTensileStrenghtMD','$dryTensileStrengthCD','$dryTensileStrengthMD','',
'','','','','','','','','','','','')";
mysql_query($sql_add) or die(mysql_error());
?>
<form method='post' action='<? echo $_SERVER['PHP_SELF']; ?>'>
<input type='hidden' name='commented' value='set'>
<?
echo "<table class=\"materials\"><tr>";
$createFaceStockSpec=array('Description','Basis Weight','Caliper','Wet Tensile Strength CD','Wet Tensile Strength MD',
'Dry Tensile Strength CD','Dry Tensile Strength MD','Opacity','Gloss','Brightness','Moisture Content','Relative Humidity',
'Absorption','Smoothness','Tear Strength CD','Tear Strength MD','Burst Strength','PH');
$enter = array('description','basisWeight','caliper','wetTensileStrenghtCD','wetTensileStrenghtMD',
'dryTensileStrengthCD','dryTensileStrengthMD','opacity','gloss','brightness','moistureContent','relativeHumitity',
'absorbtion','smoothness','tearStrengthCD','tearStrengthMD','burstStrength','pH');
for($x = 0; $x<count($createFaceStockSpec); $x++) {
echo "<tr><td width=\"200px\" colspan=\"2\" valign=\"top\">".$createFaceStockSpec[$x]."</td>\n";
echo "<td width=\"200px\" colspan=\"2\"><input type=\"text\" name=\"".$enter[$x]."\" SIZE=\"20\"></td></tr>\n";
}
?>
<tr><td width=100px colspan=2 valign=top><input type='reset' class='btn' value='Reset Face Stock'></td>
<td width=100px colspan=3><input type='submit' class='btn' name='something' value='Add Face Stock'></td></tr>
</form>
<?
}
?>