Arrays and HTML forms

    Date: 03/23/05 (PHP Community)    Keywords: html

    So I have series of checkboxes in an HTML form (which are the days of the week, typically) that create an array that later gets returned via implode(). The form contains validation for certain fields (it will not be processed if certain fields are empty/invalid and the form will have to be displayed again). It's easy enough to echo the values that have previously been set in text fields and radio buttons (like so):

    if (isset($_POST['fullname'])) {echo ' value="' . $_POST['fullname'] . '"';}

    But I don't know how to do the same thing for this array, where I don't know how many total variables it contains or even what order the keys would be set in. I tried the following, which does not work:


    if (isset($_POST['dayschecked']['Monday'])) {echo ' checked="checked"';}


    I apologize if I'm being noobish, but if I can get this done tonight I can go to sleep on time tonight (...not really).

    Source: http://www.livejournal.com/community/php/276339.html

« Community promotion || PHP / javascript problem »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home