form passing value problem in loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kiko
Forum Newbie
Posts: 23
Joined: Fri Sep 07, 2007 6:42 am

form passing value problem in loop

Post 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());
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: form passing value problem in loop

Post by Christopher »

It is not clear what your are asking or what you want to do.
(#10850)
kiko
Forum Newbie
Posts: 23
Joined: Fri Sep 07, 2007 6:42 am

Re: form passing value problem in loop

Post 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.
kiko
Forum Newbie
Posts: 23
Joined: Fri Sep 07, 2007 6:42 am

Re: form passing value problem in loop

Post 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.
Post Reply