Page 1 of 1

form passing value problem in loop

Posted: Sun Mar 16, 2008 3:41 am
by kiko
Hi all,
I would like to know how to assign and get the form value when I using it in a loop. I cannot get all the input that I inserted in 'Desc' part and it is from this site http://www.dynamicdrive.com/dynamicinde ... /index.htm. May I know to get this work when I do a loop? Thanks.

a.php

Code: Select all

// this can work
<font size="2">Title:</font><br><input type="text" name="Title[]" size="40" value="<?php echo htmlentities($match[$counter], ENT_QUOTES); ?>">
</tr>
<tr>&nbsp;</tr>
// but this can only get the last input when do multiple post
<tr>
    <font size="2">Description:</font>
    <script language="JavaScript" type="text/javascript">
    <!--
    function submitForm() {
    updateRTE('Desc');
    return true;
    }
    
    initRTE("images/", "", "");
    writeRichText('Desc', '', 350, 200, true, false);
    
    //-->
    </script>
</tr>
b.php

Code: Select all

$title= $_POST['Title'];
$desc= $_POST['Desc'];
mysql_query("insert into post(title, description)values ('$title[$counter]', '$desc[$counter]')")or die (mysql_error());

Re: form passing value problem in loop

Posted: Sun Mar 16, 2008 2:53 pm
by Christopher
It is not clear what your are asking or what you want to do.

Re: form passing value problem in loop

Posted: Sun Mar 16, 2008 10:04 pm
by kiko
mm.. I need to know inside a while loop, how to assign the field name 'Desc' (in array) of a.php. This is because I can't get the value of 'Desc' and I don't know how to put an array to the javascript code. Thanks.

Re: form passing value problem in loop

Posted: Tue Mar 18, 2008 1:46 pm
by kiko
anyone please?? I can get the 'Title[]' part but I can't in 'Desc[]' part. this part is originally from the site that in the 1st post of this thread. thanks in advance for whoever offer help.