On Tue, Apr 8, 2008 at 9:30 AM, Mark Weaver <[EMAIL PROTECTED]> wrote:
> Ryan S wrote:
>
> > Hey everyone,
> >
> > A bit of a puzzle here, dont know if this is a JS problem or PHP or FF or
> .... just me.
> >
> > (My money is on the last one :p )
> >
> >
> > Here's what I am trying to do:
> > In a form  I have a listbox with the values 1-5, and under the listbox i
> have a <TD> with the id of "recips" (like so: <TD id='recips">
> >
> > I have a onChange event linked to the list box and depending on what
> number the client picks it should dynamically put the number of text boxes
> there, here is the JS code:
> >
> > ///// ############### Start JS code ############
> > function change_no_of_recipients()
> > {
> > var
> nr=document.mainform.no_of_friends.options[document.mainform.no_of_friends.selectedIndex].value;
> >        if(nr>5){nr=5;} // max number of recipients
> >    var msg = "";
> >
> > for (var x = 1; x <= nr; x++)
> >   {
> >   msg += '<table width="50%" border="0" cellspacing="2" cellpadding="2">'
> +
> >  '<tr>' +
> >    '<td nowrap="nowrap">'+ x +'. Recipient\'s name:</td>' +
> >    '<td><input type="text" name="rec_name[]" id="rec_name[]" /></td>' +
> >    '<td nowrap="nowrap">Recipient\'s email:</td>' +
> >    '<td><input type="text" name="rec_email[]" id="rec_email[]" /></td>' +
> >  '</tr>' +
> > '<tr>' +
> > '</table>';
> >   }
> >        document.getElementById('recips').innerHTML=msg;
> > }
> >
> > ///// ##################### End JS code ################
> >
> > So far on the page everything is working, but when I click the submit
> button this is my PHP processing script:
> >
> > <?php
> > print_r($_REQUEST);
> > ?>
> >
> >
> > It shows me everything that has been submitted but NOT any of the above
> dynamically made boxes values... but get this, it DOES show me all values...
> in IE7 _not_ in FF (am using 2.0.0.13)
> >
> > Anybody else face anything like this?
> > Is this a bug in FF? Is $_REQUEST wrong to catch this? Dont know what the
> @#$@ to do... ANY help even a link to a site which can shed a little light
> would be appreciated.
> >
> > Thanks in advance.
> >
> > /Ryan
> >
> >
>
>  Hi Ryan,
>
>  Since I'm relatively new to PHP I could be off on this, but I'd say yes,
> $_REQUEST is wrong. I would think you'd want to use $_POST to receive the
> incoming values from a form.
>
>  --
>
>  Mark

I think in this case $_REQUEST and $_POST should both get you what you
want. I'm wondering whether your javascript is inserting the form
fields within the correct <FORM></FORM> tags.

Also, FWIW, I doubt it has anything to do with your problem but you
are assigning the same value for ID each time through the loop. The ID
attribute is supposed to be unique for each element on the page.

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to