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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.