Jump to content

[SOLVED] php form help


edawg

Recommended Posts

Im trying to build a form using php and mysql, the thing i want to do is have people refer my site to others via email,

ive made 6 text boxs like so..

 

<div class="registration_line">Friends Email: <input type="text" name="picemail1"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail2"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail3"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail4"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail5"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail6"  size="30" maxlength="25" /></div><br />

 

What i want to do is be able to cut down on the code and make name="picemail1" into an array somehow, this is my problem, im not to sure how to implement this, and then call it up in the handle page, ive been using...

 

<div class="registration_line">Friends Email: <input type="text" name="picemail[]"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail[]"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail[]"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail[]"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail[]"  size="30" maxlength="25" /></div><br />
<div class="registration_line">Friends Email: <input type="text" name="picemail[]"  size="30" maxlength="25" /></div><br />

 

name="picemail[]"  , but when using a foreach loop, i do not get a return??.

 

what can I use??.

Link to comment
https://forums.phpfreaks.com/topic/44040-solved-php-form-help/
Share on other sites

How does you foreach loop look like?

 

This is what ive used..

 

if (!empty($_POST['picemail'])) {

$emails() = $_POST['picemail'];
foreach ($emails as $value) {
echo $value;
}

 

ive also tried...

 

if (!empty($_POST['picemail[]'])) {

$emails = $_POST['picemail[]'];
foreach ($emails as $value) {
echo $value;
}

 

Also, is there a way I can use a function on an array???.

Link to comment
https://forums.phpfreaks.com/topic/44040-solved-php-form-help/#findComment-213851
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.