Re: php & forms

From: Date: Mon, 19 May 2003 15:10:58 +0000
Subject: Re: php & forms
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-148172@lists.php.net to get a copy of this message
Thank you for saving me from my bad eyesight. Works like a champ! -Matthew CPT John W. Holmes wrote:
Hello list. I'm a newb (of course!) and am struggling getting multiple selections in a form to work. I'm populating the form data dynamically from an array, which is read from a file. I then need to let the user select things, and have those selections passed back as variables. I have tried various things in the docs, all without success. Here is what I have now: This is the page that reads the file, and displays the options, this page works fine. Please don't be too harsh of what is almost certainly crapulent syntax, but I'd appreciate cleaner ways to do it: $list=file('current.sync'); foreach ( $list as $lines_list ) {
        if (preg_match ("/\b.jsp\b/", $lines_list)) {
        echo '<font color="#FF0000"><input type="checkbox" CHECKED name="ignore[
]" Value="';
        echo $lines_list;
        echo '">';
        echo $lines_list;
        echo '</font> <br>';
        } else {
        echo '<input type="checkbox" name="ignore[]" value="';
        echo $lines_list;
        echo '">&nbsp;&nbsp;&nbsp;';
        echo $lines_list;
        echo '<br>';
} } ;?> The page that this POSTS to is: <?php ($ignores = $_POST('ignore')) ;
$ignores = $_POST['ignore']; Notice the [] instead of ()... ---John Holmes...
-- Matthew Boeckman (816) 777-2160 Manager - Systems Integration Saepio Technologies

« previous php.general (#148172) next »