Re: Form Processing

From: Date: Tue, 30 Nov 2010 00:34:19 +0000
Subject: Re: Form Processing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-309759@lists.php.net to get a copy of this message
On Monday 29 November 2010, "Ron Piggott" <ron.piggott@actsministries.org> wrote: > I am unable to retrieve the value of $referral_1 from: Sorry, I did't see the name=email attribute. It should be name="email[]", and you will get the data from the $_REQUEST['email'] variable or $_POST['email'] as array. If you want detailed information on which variables are submited to your PHP script, you can do var_dump($_REQUEST); or echo var_export($_REQUEST); And be careful of doing var_dump() or var_export() over the $GLOBALS variable (turn off register_globals). > > $new_email = mysql_escape_string ( $_POST['referral_$i'] ); > > why? > > PHP while lopp to check if any of the fields were populated: > > > > $i=1; > while ( $i <= 5 ) { > > $new_email = mysql_escape_string ( $_POST['referral_$i'] ); > > if ( strlen ( $new_email ) > 0 ) { > .... > } > > } > > > The form itself: > > > <form method="post" action=”website”> > > <p style="margin: 10px 50px 10px 50px;"><input type="text" > name="email" > maxlength="60" class="referral_1" style="width: > 400px;"></p> > > <p style="margin: 10px 50px 10px 50px;"><input type="text" > name="email" > maxlength="60" class="referral_2" style="width: > 400px;"></p> > > <p style="margin: 10px 50px 10px 50px;"><input type="text" > name="email" > maxlength="60" class="referral_3" style="width: > 400px;"></p> > > <p style="margin: 10px 50px 10px 50px;"><input type="text" > name="email" > maxlength="60" class="referral_4" style="width: > 400px;"></p> > > <p style="margin: 10px 50px 10px 50px;"><input type="text" > name="email" > maxlength="60" class="referral_5" style="width: > 400px;"></p> > > <p style="margin: 10px 50px 10px 50px;"><input type="submit" > name="submit" value="Add New Referrals"></p> > > </form> > > > What am I doing wrong? > > Ron > > The Verse of the Day > “Encouragement from God’s Word” > http://www.TheVerseOfTheDay.info Best regards, -- Daniel Molina Wegener <dmw [at] coder [dot] cl> System Programmer & Web Developer Phone: +56 (2) 979-0277 | Blog: http://coder.cl/

Attachment: [application/pgp-signature] This is a digitally signed message part. signature.asc
« previous php.general (#309759) next »