davehaz
06-07-2006, 04:09 PM
howdy, I have written a php/javascript script that I am having a problem with, don't know whether to post it here or in the js forum. This script works but pulls the data one click late. Let me know if you see what is wrong here.
let me know if I should post in the Javascript forum.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Your Shoe Size & Dimensions</title>
<script type="text/javascript" src="../scripts/sizer.js"></script>
</head>
<?php
$dbh=MySQL_connect ("localhost", "user", "pwd")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("db");
$query = "SELECT * FROM womens ORDER BY uid ASC";
$result = mysql_query($query);
echo"<form method='POST'>";
echo "<table>";
echo "<tr><td><select name='size' >";
while($data=mysql_fetch_array($result)){
echo "<option value='".$data['0']."' >".$data['0']."</option>";
}
?>
<body>
</td><td><input name='submit' type='submit' value='Select Size' onClick="
<?
$size = $_POST['size'];
$select = "SELECT * FROM womens WHERE size = '$size'";
$result=mysql_query($select);
while($info=mysql_fetch_array($result)){
$size1=$info['0'];
$length=$info['1'];
$nwd=$info['2'];
$mwd=$info['3'];
$wwd=$info['4'];
}
?>
sizer('<? echo $size1 ?>','<? echo $length ?>','<? echo $nwd ?>','<? echo $mwd ?>','<? echo $wwd ?>','#ffffcc','')" >
</td></tr></select></table></form>
</body>
</html>
what happens here is after you select the shoe size and click the submit button you get a pop up but it is not populated with the data from the db. if you select another shoe size and click submit again you get the data from the previous size selected.
tia
let me know if I should post in the Javascript forum.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Your Shoe Size & Dimensions</title>
<script type="text/javascript" src="../scripts/sizer.js"></script>
</head>
<?php
$dbh=MySQL_connect ("localhost", "user", "pwd")
or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("db");
$query = "SELECT * FROM womens ORDER BY uid ASC";
$result = mysql_query($query);
echo"<form method='POST'>";
echo "<table>";
echo "<tr><td><select name='size' >";
while($data=mysql_fetch_array($result)){
echo "<option value='".$data['0']."' >".$data['0']."</option>";
}
?>
<body>
</td><td><input name='submit' type='submit' value='Select Size' onClick="
<?
$size = $_POST['size'];
$select = "SELECT * FROM womens WHERE size = '$size'";
$result=mysql_query($select);
while($info=mysql_fetch_array($result)){
$size1=$info['0'];
$length=$info['1'];
$nwd=$info['2'];
$mwd=$info['3'];
$wwd=$info['4'];
}
?>
sizer('<? echo $size1 ?>','<? echo $length ?>','<? echo $nwd ?>','<? echo $mwd ?>','<? echo $wwd ?>','#ffffcc','')" >
</td></tr></select></table></form>
</body>
</html>
what happens here is after you select the shoe size and click the submit button you get a pop up but it is not populated with the data from the db. if you select another shoe size and click submit again you get the data from the previous size selected.
tia