htmlperlman
03-30-2005, 12:20 PM
I have the following code:
<FORM ACTION="nextform.php" METHOD=POST>
<?php
// open the connection
$conn = mysql_connect("localhost","user","pass");
// pick the database to use
mysql_select_db("db1",$conn);
// create the SQL statement
$sql = "SELECT * FROM table";
// execute the SQL statement
$result = mysql_query($sql, $conn) or die(mysql_error());
//go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields
$exe1 = $newArray['exe'];
echo "$exe1 ";
$size1 = $newArray['size'];
echo "$size1 ";
$pub1 = $newArray['pub'];
if ($pub1 != NULL) echo ("$pub1 ");
else echo ('<input type=text name="newpub" size=50>');
$app1 = $newArray['app'];
if ($app1 != NULL) echo ("$app1 ");
else echo ('<input type=text name="newapp" size=50>');
$vers1 = $newArray['vers'];
if ($vers1 != NULL) echo ("$vers1 ");
else echo ('<input type=text name="newvers" size=20>');
$num1 = $newArray['number'];
echo "$num1 <br>";
}
?>
<br><center><input type=submit name="submit" value="SUBMIT NEW VALUES"></center>
</FORM>
SO THE PROBLEM IS THIS::::
Effectively for every entry in the table the script will always display the first 2 fields (exe1 and size1). Then for the next 3 fields it will either display the value, or if its null display a text box asking for entry of the value. The problem I have occurs when more than one entry has these fields missing.....as the script can only send the new values (called newpub, newapp and newvers) once and so will only send the last entry of values to the next page. What I want is for all text entered to be sent to the next page where it will be saved to the file.
Any ideas????
Cheers
Dave
<FORM ACTION="nextform.php" METHOD=POST>
<?php
// open the connection
$conn = mysql_connect("localhost","user","pass");
// pick the database to use
mysql_select_db("db1",$conn);
// create the SQL statement
$sql = "SELECT * FROM table";
// execute the SQL statement
$result = mysql_query($sql, $conn) or die(mysql_error());
//go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields
$exe1 = $newArray['exe'];
echo "$exe1 ";
$size1 = $newArray['size'];
echo "$size1 ";
$pub1 = $newArray['pub'];
if ($pub1 != NULL) echo ("$pub1 ");
else echo ('<input type=text name="newpub" size=50>');
$app1 = $newArray['app'];
if ($app1 != NULL) echo ("$app1 ");
else echo ('<input type=text name="newapp" size=50>');
$vers1 = $newArray['vers'];
if ($vers1 != NULL) echo ("$vers1 ");
else echo ('<input type=text name="newvers" size=20>');
$num1 = $newArray['number'];
echo "$num1 <br>";
}
?>
<br><center><input type=submit name="submit" value="SUBMIT NEW VALUES"></center>
</FORM>
SO THE PROBLEM IS THIS::::
Effectively for every entry in the table the script will always display the first 2 fields (exe1 and size1). Then for the next 3 fields it will either display the value, or if its null display a text box asking for entry of the value. The problem I have occurs when more than one entry has these fields missing.....as the script can only send the new values (called newpub, newapp and newvers) once and so will only send the last entry of values to the next page. What I want is for all text entered to be sent to the next page where it will be saved to the file.
Any ideas????
Cheers
Dave