Re: Form Processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 29, 2010 at 18:54, Ron Piggott
<ron.piggott@xxxxxxxxxxxxxxxxxx> wrote:
>
> $new_email = mysql_escape_string ( $_POST['referral_$i'] );

    Because you're using literal quotes, so PHP is literally looking
for the POST reference 'referral_$i'.

    Instead of using the style of field names you're using, why not
use a virtually limitless array?

<?php

if (isset($_POST['referral']) && is_array($_POST['referral'])) {
    $refcnt = count($_POST['referral']);
    for ($i=0;$i<$refcnt;$i++) {
        echo 'Referral #'.$i.': '.$_POST['referral'][$i].'<br/>'.PHP_EOL;
    }
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <?php
    for ($i=1;$i<6;$i++) {
        echo ' &nbsp; &nbsp;<input type="text" name="referral[]"
id="referral_'.$i.'"/><br/>'.PHP_EOL;
    }
    ?>
    <input type="submit" id="submitButton" value="Send"/>
</form>

-- 
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux