Thanks, but I think I will be a little more explicit here
about what I really wanted to know. My impression is that if I have
a DataGrid and that I would like to allow users to edit certain
entries within the actual grid and have all of it saved to the
database, I could use a for loop and just update everything without
paying attention to what has really been updated, but I have been
struggling with how to pass it all to the variables side.
Currently, I could update things one entry a time, by using the
code I provided earlier, but is there a way of which I can have it
all posted to the HTTPService in one go?
Note: I tried using dg.
.id_no in the for loop to iterate over the variables I intend to
post, but I don't think I am allowed to do so, do I?
Alice
Attached is what I used in a PHP script to allow the code
loop around the users' edits, how could I do the similar thing in
Flex by assigning the index variable to something more dynamic?
Attach Code
<?php
if(!isset($_POST['npop'])){
// this is where the user will select how many pops to insert
?>
<form method="post">
<input type="text" name="npop" value="Type in how many
post values">
<input type="submit" value="Continue">
</form>
<?
} else {
if(!isset($_POST['pop'])){
$pop = $_POST['npop'];
// when the user has selected the N number of pops
// its time to create the N input elements
?>
<form method="post">
<input type="hidden" name="npop"
value="<?=$pop;?>">
<input type="hidden" name="pop" value="0">
<?
for($i = 1;$i <= $pop; $i++){
echo "<h3>Pop $i</h3>";
// now comes the 5 input elements..
// add them as u like naming them in the following pattern,
// or whatever prefix
?>
Market: <input type="text" name="a<?=$i;?>"
value="0"><br />
IM_accept: <input type="text" name="b<?=$i;?>"
value="0"><br />
IM_defer: <input type="text" name="c<?=$i;?>"
value="0"/><br />
CR_accept : <input type="text" name="d<?=$i;?>"
value="0"><br />
FC_accept : <input type="text" name="e<?=$i;?>"
value="0"><br />
<?
}
?>
<input type="Submit" value="Submit form">
</form>
<?
} else {
$pop = $_POST['npop'];
// when the user has submitted the pops,
// they will be inserted to N rows in the table.
for($i = 1; $i <= $pop; $i++){
$a = $_POST['a'.$i]; $b = $_POST['b'.$i]; $c =
$_POST['c'.$i];
$d = $_POST['d'.$i]; $e = $_POST['e'.$i];
$sql = "insert INTO table VALUES('$a', '$b', '$c', '$d',
'$e')" . "\n";
echo $sql;
$myFile = "testFile.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, $sql);
fclose($fh);
}
echo "POPs were recorded. Thank you";
}
}
?>