Jump to content

Isaiaha

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Isaiaha's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you - system solved $checked = false; had to be put in after the first while!
  2. Hi Thank you - i might have missed it in the posting... this is where i'm at now which is working tons better but having a glitch described at the bottom - wondering if anyone knows? Here's the code: $checked = false; while ($div=mysql_fetch_assoc($query4)) { //$query4 contains all the checkboxes while($row22=mysql_fetch_assoc($query2)) { //query2 contains the checked checkboxes if($div['date_id'] == $row22['date_id']) { $checked = true; } } //display the checkbox if($checked) { //display checkbox with checked="checked" echo '<input type="checkbox" value="' . $div[date_id] .'" "checked">' . $div[date] . '</option>'; } else { //display checkbox without being checked echo '<input type="checkbox" value="' . $div[date_id] .'">' . $div[date] . '</option>'; } //reset the pointer in $row22 back to the start mysql_data_seek($query2,0); } This is what happens: Anytime checkbox #1 is selected: displays all checkboxes as checked If checkbox #2 is selected: displays 2&3 checked If checkbox #3 is selected: displays correctly - only 3 is checked. If checkbox 2&3 selected: display correctly I hope I haven't kiboshed your code... i was trying something sort of like your code (mine was much messier) and I was having the same issue. Wondering what would make it act that way.
  3. Here's more information: $query2 checks which checkboxes the user has selected wants to verify it against all the checkboxes in $query4 than mark $query2 checkboxes as checked. Thank you
  4. while ($div=mysql_fetch_array($query4, MYSQL_ASSOC)) { //$div - shows all the entries $row22=mysql_fetch_array($query2, MYSQL_ASSOC); //row22 - shows all the entries that should be checked $name= array($div['date_id']); $datess=$row22['date_id']; if (in_array($datess, $name, true)) { echo '<input type="checkbox" value="' . $div[date_id] .'" checked>' . $div[date] . '</option>'; }else{ echo '<input type="checkbox" value="' . $div[date_id] .'">' . $div[date] . '</option>'; } 1. when echo $row22 shows only the entries that should be checked - working good 2. checkboxes show checked if only the first checkbox is selected or all 3 - if a combination is selected, it is all blank. Any ideas? Thank you
  5. Problem solved! - instead of using number keys use value keys! $months = array ('January' => January, 'February' => February, 'March' => March, 'April' => April, 'May' => May, 'June' => June, 'July' => July, 'August' =>August, 'September' => September, 'October' => October, 'November' => November, 'December' => December); Thanx
  6. Hi Thank you for your help in advance. I have an array generate drop down list and after form is submitted I'd like to have the value and not the key inserted into mysql - i have used array_value, implode and I either get a blank entry, 'array' entry, or the key. any help would be appreciated. $months = array (1=>'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); if(isset($_POST['Submitted'])) { $sticky_months = $_POST['month']; } echo '<select id="size-1" name="month">'; echo '<option value="sm" >Select Month</option>'; foreach ($months as $key => $value) { if($key == $sticky_months) { echo '<option value="' . $key .'" selected>' . $value . '</option>'; }else{ echo '<option value="' . $key .'">' . $value . '</option>'; } } $query = "INSERT INTO summer09 (user_id, reg_date, month) VALUES (NULL, NOW(),'$month')";
×
×
  • 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.