Hi everybody
With the following script I'm getting mad
This concerns a table for members, where the field 'msg' contains 'e' for email, or '.' for unschecked, to select the members, who will receive an email or not. The script use PHP_SELF and a form, and ONLY ONE SUBMIT.
What do I want?
1) display all the records of this table using INPUT to be able to modify the field 'msg'.
2) can modify the content of this field for some of the records, as many time as I want, BUT NOT FOR ALL THE RECORDS
How do I wish to do it?
By opening a
php:
for($i = 0; $i <= $v_ct; $i++){
?>
where I associate a '$v_msg = $myrowchk["msg"];'
But after the SUBMIT (only one for ALL RECORDS AT ONCE) the values of $v_msg have disapeared.
I can not use any
php:
session_register("v_msg");
?>
--------------------------------------------------------------------------------
Please have a look and send me your solutions
Here is the code:
php:
<?php
session_start();
session_register("v_ct");
?>
<html>
<head>
<title>test li</title>
</head>
<body>
<?php
include "include/get_root_abc.inc";
if ($submit) {
echo "v_ct $v_ct<br>";
for($i = 0; $i <= $v_ct; $i++){
$resultvw = mysql_query("SELECT * FROM li WHERE lid=$i",$db);
while ($myrowvw = mysql_fetch_array($resultvw)) {
$vv_lid =$myrowvw["lid"];
$vv_first =$myrowvw["first"];
$vv_msg = $v_msg[i];
echo "line 30 i $i lid $vv_lid first $vv_first msg_i $vv_msg<br>";
$sql = "UPDATE li SET msg=$v_msg[i] WHERE lid=$i";
$result = mysql_query($sql);
echo "Record $i updated/edited!";
}
}
} elseif ($delete) { } else {
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<?php
echo "<p align=\"center\"><b><font face=\"Arial\" size=\"5\">ABC checking the email list member by member</font><br><br><font face=\"Arial\" size=\"3\" color=\"red\">Please enter either 'e' or '.' but NOT 'E' or ',' or ';', thank you</font></b></p>";
$v_ct = 0;
$resultct = mysql_query("SELECT * FROM li",$db);
while ($myrowct = mysql_fetch_array($resultct)) {
$v_ct = $v_ct + 1;
}
for($i = 0; $i <= $v_ct; $i++){
$v_line[i] = $i;
echo "<table>\n";
$resultchk = mysql_query("SELECT * FROM li WHERE lid=$i",$db);
while ($myrowchk = mysql_fetch_array($resultchk)) {
$v_msg[i] = $myrowchk["msg"];
$msg = $myrowchk["msg"];
$v_enr = $myrowchk["lid"];
$v_first = $myrowchk["first"];
$v_last = $myrowchk["last"];
$v_tel = $myrowchk["phone"];
$v_ctry = $myrowchk["country"];
$v_city = $myrowchk["city"];
echo "<tr><td align=\"right\" width=\"25\">$v_line[i]<td align=\"right\" width=\"25\">$v_enr<td width=\"200\">$v_first $v_last<td align=\"right\" width=\"200\">$v_tel<td align=\"right\" width=\"100\">$v_ctry<td width=\"150\">$v_city";
?>
<td><input type="text" name="v_msg" size="1" value="<?php echo $msg ?>"><td><font face="Arial" size="3"><b>e <br><b>.<td><b>= email<br><b>= unchecked</b></font><br>
<?php
}
echo "</table>";
?>
<?php
}
}
?>
<br><br><input type="Submit" name="submit" value="Enter information">
<a href="javascript:history.go(-1)">BACK</a>
</form>
</body>
</html>
Denis