winuser2003 Posted November 17, 2009 Share Posted November 17, 2009 hello, Thanks for looking this over and helping me out. My problem is I have a online store locator database and whats happening is I keep getting an "array" message when I look at the store. I am working with the following code... The first file I created was something called countrydropdown.php and here is the code in that file.. function countrydropdown() { ?> <form method="post"> Please choose type of Party Occsaion Hosted::<br /><br /> Weddings:<input type="checkbox" value="Weddings" name="country[]">: Birthday Parties:<input type="checkbox" value="Birthday" name="country[]">: Social Events:<input type="checkbox" value="Social" name="country[]">:<br /><br /> Games:<input type="checkbox" value="Games" name="country[]">: Anniversaries:<input type="checkbox" value="Anniversaries" name="country[]">: Fantasy Leagues:<input type="checkbox" value="Fantasy" name="country[]">:<br /><br /> Meetings:<input type="checkbox" value="Meetings" name="country[]">: Sports:<input type="checkbox" value="Sports" name="country[]">: Awards:<input type="checkbox" value="Awards" name="country[]">: Baby Showers:<input type="checkbox" value="Baby Showers" name="country[]">:<br /><br /> Kid Friendly: Yes:<input type="checkbox" value="Yes" name="country[]">: No:<input type="checkbox" value="No" name="country[]">: <?php } ?> The second file I am working with is the inc_newstore.php and its contents are... include("inc_security.php"); global $strFormadminstate; screenheading("Party Room Submission Form"); print("<form action=\"{$_SERVER['PHP_SELF']}\" method=\"post\">\n"); print("<input type=\"hidden\" name=\"pageaction\" value=\"savestore\">\n"); print $strFormadminstate; print("<table class=\"newtable\" width=\"572\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n"); print(" <tr>\n"); print(" <td width=\"110\" class=\"newhead\"> Capacity</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"companystoreID\" size=\"20\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Store name</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"storename\" size=\"40\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Address</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"address\" size=\"40\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> City</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"city\" size=\"40\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> State</td>\n"); print(" <td class=\"newtext\">"); include ("statedropdown.php"); print(" <tr>\n"); print(" <td class=\"newhead\"> Zip / Post Code</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"zippostcode\" size=\"20\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Telephone 1</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"telephone1\" size=\"30\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Telephone 2</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"telephone2\" size=\"30\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Fax</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"fax\" size=\"30\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Email</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"email\" size=\"50\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Website</td>\n"); print(" <td class=\"newtext\">http:// <input type=\"text\" name=\"website\" size=\"50\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Party Occasions</td>\n"); print(" <td class=\"newtext\">"); countrydropdown(); print(" <tr>\n"); print(" <td class=\"newhead\">Description of <br/>Party Room<br>Kid Friendly<br>Wi-Fi Access<br>Or Other Features<br></td>\n"); print(" <td class=\"newtext\"><textarea name=\"description\" rows=\"5\" cols=\"40\" onkeyup=\"CheckFieldLength(description, 'charcount1', 'remaining1', 255);\" onkeydown=\"CheckFieldLength(description, 'charcount1', 'remaining1', 255);\" onmouseout=\"CheckFieldLength(description, 'charcount1', 'remaining1',255);\"></textarea><br>\n"); print("<small><span id=\"charcount1\">0</span> characters entered. | <span id=\"remaining1\">255</span> characters remaining.</small>\n"); print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Store Hours</td>\n"); print(" <td class=\"newtext\">\n"); print("<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">"); print(" <tr>\n"); print(" <td></td><td class=\"hourshead\">OPEN</td><td class=\"hourshead\">CLOSE</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Monday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"openmonday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closemonday\" size=\"15\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Tuesday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"opentuesday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closetuesday\" size=\"15\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Wednesday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"openwednesday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closewednesday\" size=\"15\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Thursday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"openthursday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closethursday\" size=\"15\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Friday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"openfriday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closefriday\" size=\"15\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Saturday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"opensaturday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closesaturday\" size=\"15\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Sunday</td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"opensunday\" size=\"15\"></td>\n"); print(" <td class=\"hourstext\"><input type=\"text\" name=\"closesunday\" size=\"15\"></td>\n"); print(" </tr>\n"); print("</table>\n"); print("<br>\n"); print("Other hours information<br>\n"); print("<textarea name=\"opencloseinfo\" rows=\"5\" cols=\"40\" onkeyup=\"CheckFieldLength(opencloseinfo, 'charcount2', 'remaining2', 255);\" onkeydown=\"CheckFieldLength(opencloseinfo, 'charcount2', 'remaining2', 255);\" onmouseout=\"CheckFieldLength(opencloseinfo, 'charcount2', 'remaining2',255);\"></textarea><br>\n"); print("<small><span id=\"charcount2\">0</span> characters entered. | <span id=\"remaining2\">255</span> characters remaining.</small>\n"); print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Store Manager</td>\n"); print(" <td class=\"newtext\"><input type=\"text\" name=\"storemanager\" size=\"40\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Map Link</td>\n"); print(" <td class=\"newtext\">http:// <input type=\"text\" name=\"maplink\" size=\"50\"></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Directions</td>\n"); print(" <td class=\"newtext\"><textarea name=\"directions\" rows=\"5\" cols=\"40\" onkeyup=\"CheckFieldLength(directions, 'charcount3', 'remaining3', 255);\" onkeydown=\"CheckFieldLength(directions, 'charcount3', 'remaining3', 255);\" onmouseout=\"CheckFieldLength(direcitons, 'charcount3', 'remaining3',255);\"></textarea><br>\n"); print("<small><span id=\"charcount3\">0</span> characters entered. | <span id=\"remaining3\">255</span> characters remaining.</small>\n"); print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"newhead\"> Active</td>\n"); print(" <td class=\"newtext\"><input type=\"checkbox\" name=\"recordstatus\" value=\"active\" checked></td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td> </td>\n"); print(" <td><input type=\"submit\" value=\"save store\"></td>\n"); print(" </tr>\n"); print("</table>\n"); print("</form>\n"); print("<div id=\"bottomspacer\"></div>\n"); ?> Finally the third file is inc_viewstore.php file and its contents is... include("inc_security.php"); screenheading("Viewing Party Room Record"); if (isset($_REQUEST['id'])) (int)$intID = addslashes($_REQUEST['id']); else $intID = null; $SQLstmt = "SELECT storeID, companystoreID, storename, address, city, suburb, " . "statename, country, zippostcode, telephone1, telephone2, fax, " . "email, website, description, openmonday, closemonday, opentuesday, " . "closetuesday, openwednesday, closewednesday, openthursday, " . "closethursday, openfriday, closefriday, opensaturday, closesaturday, " . "opensunday, closesunday, opencloseinfo, storemanager, maplink, " . "directions, recordstatus, slstore.recordlastmodified, " . "slstore.recordlastmodifiedby, slstore.recordcreated, " . "slstore.recordcreatedby FROM slstore LEFT JOIN slstate ON " . "slstore.stateID = slstate.stateID WHERE storeID = '$intID'"; if ($resultSet = dbaction($SQLstmt)) { $row = getrsrow($resultSet); print("<table width=\"572\" class=\"viewtable\" border=\"0\" cellpadding=\"4\" cellspacing=\"2\">\n"); print(" <tr>\n"); print(" <td class=\"viewhead\" width=\"120\"> Store ID</td>\n"); print(" <td class=\"viewtext\">{$row['storeID']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Capacity</td>\n"); print(" <td class=\"viewtext\">{$row['companystoreID']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Store Name</td>\n"); print(" <td class=\"viewtext\">{$row['storename']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Address</td>\n"); print(" <td class=\"viewtext\">{$row['address']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> City</td>\n"); print(" <td class=\"viewtext\">{$row['city']}</td>\n"); print(" </tr>\n"); print(" <td class=\"viewhead\"> State</td>\n"); print(" <td class=\"viewtext\">{$row['statename']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Zip / Post Code</td>\n"); print(" <td class=\"viewtext\">{$row['zippostcode']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Telephone 1</td>\n"); print(" <td class=\"viewtext\">{$row['telephone1']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Telephone 2</td>\n"); print(" <td class=\"viewtext\">{$row['telephone2']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Fax</td>\n"); print(" <td class=\"viewtext\">{$row['fax']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Email</td>\n"); print(" <td class=\"viewtext\">"); if ($row['email'] != "") print("<a href=\"mailto:{$row['email']}\">{$row['email']}</a>"); print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Website</td>\n"); print(" <td class=\"viewtext\">"); if ($row['website'] != "") print("<a href=\"http://{$row['website']}\" target=\"_blank\">{$row['website']}</a>"); print("</td>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Party Occasion</td>\n"); print(" <td class=\"viewtext\">{$row['country']}</td>\n"); print(" </tr>\n"); print(" <td class=\"viewhead\"> Description of <br/>Party Room<br>Kid Friendly<br>Wi-Fi Access<br>Or Other Features<br></td>\n"); print(" <td class=\"viewtext\">{$row['description']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Store Hours</td>\n"); print(" <td class=\"viewtext\">\n"); print("<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">"); print(" <tr>\n"); print(" <td></td><td class=\"hourshead\">OPEN</td><td class=\"hourshead\">CLOSE</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Monday</td>\n"); print(" <td class=\"hourstext\">{$row['openmonday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closemonday']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Tuesday</td>\n"); print(" <td class=\"hourstext\">{$row['opentuesday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closetuesday']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Wednesday</td>\n"); print(" <td class=\"hourstext\">{$row['openwednesday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closewednesday']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Thursday</td>\n"); print(" <td class=\"hourstext\">{$row['openthursday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closethursday']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Friday</td>\n"); print(" <td class=\"hourstext\">{$row['openfriday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closefriday']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Saturday</td>\n"); print(" <td class=\"hourstext\">{$row['opensaturday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closesaturday']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"hoursday\">Sunday</td>\n"); print(" <td class=\"hourstext\">{$row['opensunday']}</td>\n"); print(" <td class=\"hourstext\">{$row['closesunday']}</td>\n"); print(" </tr>\n"); print("</table>\n"); print("<br>\n"); print("Other hours information<br>\n"); print $row['opencloseinfo']; print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Store Manager</td>\n"); print(" <td class=\"viewtext\">{$row['storemanager']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Map Link</td>\n"); print(" <td class=\"viewtext\">"); if ($row['maplink'] != "") print("<a href=\"http://{$row['maplink']}\" target=\"_blank\">{$row['maplink']}</a>"); print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Directions</td>\n"); print(" <td class=\"viewtext\">{$row['directions']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Record Status</td>\n"); print(" <td class=\"viewtext\">"); if ($row['recordstatus'] == "active") print("active"); else print("inactive"); print("</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Last Modified</td>\n"); print(" <td class=\"viewtext\">{$row['recordlastmodified']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Last Modified By</td>\n"); print(" <td class=\"viewtext\">{$row['recordlastmodifiedby']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Created</td>\n"); print(" <td class=\"viewtext\">{$row['recordcreated']}</td>\n"); print(" </tr>\n"); print(" <tr>\n"); print(" <td class=\"viewhead\"> Created By</td>\n"); print(" <td class=\"viewtext\">{$row['recordcreatedby']}</td>\n"); print(" </tr>\n"); print("</table>\n"); print("<div id=\"bottomspacer\"></div>\n"); } ?> Now I know my problem is somewhere in the file "inc_viewstore". The line with the issue is... print (" <tr>\n"); print(" <td class=\"viewhead\"> Party Occasion</td>\n"); print(" <td class=\"viewtext\">{$row['country']}</td>\n"); print(" </tr>\n"); When I tested this I kept seeing the word "Array" popup under "Party Occasion". I took a screenshot EDIT: Seriously dude.. use CODE tags Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/ Share on other sites More sharing options...
sasa Posted November 17, 2009 Share Posted November 17, 2009 change print(" <td class=\"viewtext\">{$row['country']}</td>\n"); to print(" <td class=\"viewtext\">".implode(', ', $row['country'])."</td>\n"); Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-959463 Share on other sites More sharing options...
winuser2003 Posted November 17, 2009 Author Share Posted November 17, 2009 change print(" <td class=\"viewtext\">{$row['country']}</td>\n"); to print(" <td class=\"viewtext\">".implode(', ', $row['country'])."</td>\n"); I got the error that its an invalid argument passed in inc_viewstore.php on line 99 I maybe missing something somewhere... Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-959508 Share on other sites More sharing options...
bossman Posted November 18, 2009 Share Posted November 18, 2009 use the CODE tags for posting code like this Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-960053 Share on other sites More sharing options...
sasa Posted November 18, 2009 Share Posted November 18, 2009 print(" <td class=\"viewtext\">".(isset($row['country']) ? implode(', ', $row['country']) : '')."</td>\n"); Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-960067 Share on other sites More sharing options...
winuser2003 Posted November 18, 2009 Author Share Posted November 18, 2009 print(" <td class=\"viewtext\">".(isset($row['country']) ? implode(', ', $row['country']) : '')."</td>\n"); I inserted the new code you provided SASA but still for some reason I am getting the same error message. Below I provided the screen shots, and also I am going to provide you the package itself. I been googling arrays and some are pointing to use the $array, but I do not see that doing anything. Other people have gotten the same error, and its with how the line itself is written. I am going to keep looking and again I appreciate your help with this, its beating me trying to figure it out. Below are the screenshots and the link to download the package. Change the settings in the settings.php file to match your own. Let me know if you come up with the fix and I will do the same. Inserted the advised script to the Line... Tested the result from a store already created... created another new store to test and showing area not being viewed in records Same Result with New Store Created Link to Download Package and Test www.bookapartyroom.com/store/store.zip Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-960320 Share on other sites More sharing options...
sasa Posted November 19, 2009 Share Posted November 19, 2009 error is in part where you insert value in database if you want insert array in db you must inplode it first Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-960821 Share on other sites More sharing options...
Trizen Posted November 19, 2009 Share Posted November 19, 2009 i had this type of problem but i kinda pulled a hack per say. i needed a check box for each of the 50 states on a website i did. i used magic quotes and did a $states array. but i think you would need to change the coutrydropdown.php and the inc_viewstore.php to do this. however if you server is running on phpv6 it is not going to work since support for magic quotes is removed but everything under that should still work. <td height="40" colspan="4" align="left"><div align="left">What State or States do you currently accept bail in?</div></td> </tr> <TR></TR> </TABLE> <table width="927" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="157"><div align="left"> <p> <input type="checkbox" name="boxes[]" value="Alabama"/> <span class="style4"> ALABAMA<br> <input type="checkbox" name="boxes[]" value="Alaska"/> ALASKA <br> <input type="checkbox" name="boxes[]" value="Arizona"/> ARIZONA <br> <input type="checkbox" name="boxes[]" value="Arkansas"> ARKANSAS<br> <input type="checkbox" name="boxes[]" value="California"> CALIFORNIA <br> <input type="checkbox" name="boxes[]" value="Colorado"> COLORADO <br> <input type="checkbox" name="boxes[]" value="Connecticut"> CONNECTICUT <br> <input type="checkbox" name="boxes[]" value="Delaware"> DELAWARE <br> <input type="checkbox" name="boxes[]" value="District Of Columbia"> DISTRICT OF COLUMBIA <br> <input type="checkbox" name="boxes[]" value="Florida"> FLORIDA <br> <input type="checkbox" name="boxes[]" value="Georgia"> GEORGIA <br> <input type="checkbox" name="boxes[]" value="Hawaii"> HAWAII <br> <input type="checkbox" name="boxes[]" value="Idaho"> IDAHO<br> <input type="checkbox" name="boxes[]" value="Illinois"> ILLINOIS <br> <input type="checkbox" name="boxes[]" value="Indiana"> INDIANA<br> <input type="checkbox" name="boxes[]" value="Iowa"> IOWA <br> <input type="checkbox" name="boxes[]" value="Kansas"> KANSAS </span><br> </div></td> <td width="148" valign="top"><div align="left"> <p> <input type="checkbox" name="boxes[]" value="Louisisana"> <span class="states style4">LOUISIANA<br> <input type="checkbox" name="boxes[]" value="Kentucky"> KENTUCKY<br> <input type="checkbox" name="boxes[]" value="Maine"> MAINE<br> <input type="checkbox" name="boxes[]" value="Maryland"> MARYLAND<br> <input type="checkbox" name="boxes[]" value="Massachusetts"> MASSACHUSETTS<br> <input type="checkbox" name="boxes[]" value="Michigan"> MICHIGAN<br> <input type="checkbox" name="boxes[]" value="Minnesota"> MINNESOTA<br> <input type="checkbox" name="boxes[]" value="Mississippi"> MISSISSIPPI<br> <input type="checkbox" name="boxes[]" value="Missouri"> MISSOURI<br> <input type="checkbox" name="boxes[]" value="Montana"> MONTANA<br> <input type="checkbox" name="boxes[]" value="Nebraska"> NEBRASKA<br> <input type="checkbox" name="boxes[]" value="Nevada"> NEVADA<br> <input type="checkbox" name="boxes[]" value="New Hampshire"> NEW HAMPSHIRE<br> <input type="checkbox" name="boxes[]" value="New Jersey"> NEW JERSEY<br> <input type="checkbox" name="boxes[]" value="New Mexico"> NEW MEXICO<br> <input type="checkbox" name="boxes[]" value="New York"> NEW YORK<br> <input type="checkbox" name="boxes[]" value="North Carolina"> NORTH CAROLINA </span><br> </p> </div></td> <td width="622"><p><input type="checkbox" name="boxes[]" value="North Dakota"> <span class="style4">NORTH DAKOTA<br> <input type="checkbox" name="boxes[]" value="Ohio"> OHIO<br> <input type="checkbox" name="boxes[]" value="Oklahoma"> OKLAHOMA<br> <input type="checkbox" name="boxes[]" value="Oregon"> OREGON<br> <input type="checkbox" name="boxes[]" value="Pennsylvania"> PENNSYLVANIA<br> <input type="checkbox" name="boxes[]" value="Rhode Island"> RHODE ISLAND<br> <input type="checkbox" name="boxes[]" value="South Carolina"> SOUTH CAROLINA <br> <input type="checkbox" name="boxes[]" value="South Dakota"> SOUTH DAKOTA<br> <input type="checkbox" name="boxes[]" value="Tennessee"> TENNESSEE<br> <input type="checkbox" name="boxes[]" value="Texas"> TEXAS<br> <input type="checkbox" name="boxes[]" value="Utah"> UTAH<br> <input type="checkbox" name="boxes[]" value="Vermont"> VERMONT<br> <input type="checkbox" name="boxes[]" value="Virginia"> VIRGINIA<br> <input type="checkbox" name="boxes[]" value="Washington"> WASHINGTON<br> <input type="checkbox" name="boxes[]" value="West Virginia"> WEST VIRGINIA <br> <input type="checkbox" name="boxes[]" value="Wisconsin"> WISCONSIN<br> <input type="checkbox" name="boxes[]" value="Wyoming"> WYOMING</span> </p> this was my html for the states <?php //firstly grab all the form variables and put them in an array called $form foreach ($_POST as $varname=>$value) { $form[$varname]=$value; if(get_magic_quotes_gpc()) $form[$varname]=stripslashes($form[$varname]); //gets rid of slashes if magic quotes is on } //Build $message $message.=""; //etc etc - fill the other form values //build in states bit $states=array(); foreach ($boxes as $states) { $ylist = $ylist . "'" . $states . "' "; }} $message.="$ylist '\r\n'"; ?> This is to grab it up to do whatever with it print(" <td class=\"viewtext\">{$row['message']}</td>\n"); now i make it print to the page. im not even sure if this will help but this is what i did Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-960841 Share on other sites More sharing options...
winuser2003 Posted November 20, 2009 Author Share Posted November 20, 2009 error is in part where you insert value in database if you want insert array in db you must inplode it first I have tried so many ways just to get checkboxes, and its just not working. Would there be anyway to show me? maybe remote into my server and show me? I am so stressed out from this, I am googling, taking your advise, and getting the checkboxes in general is easy, the problem is getting the results in the records to show. If I can see how this is done then it would be a load off. SASA would you mind showing me? I can let you remote into my server and I can show you everything. Please if you do not mind helping me out, I figured this was easy. Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-961748 Share on other sites More sharing options...
sasa Posted November 20, 2009 Share Posted November 20, 2009 change if (isset($_REQUEST['country'])) $strCountry = addslashes($_REQUEST['country']); else $strCountry = NULL; to if (isset($_REQUEST['country'])) $strCountry = addslashes(implode(',',$_REQUEST['country'])); else $strCountry = NULL; in files: inc_savestore.php and inc_updatestore.php Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-961898 Share on other sites More sharing options...
winuser2003 Posted November 20, 2009 Author Share Posted November 20, 2009 change if (isset($_REQUEST['country'])) $strCountry = addslashes($_REQUEST['country']); else $strCountry = NULL; to if (isset($_REQUEST['country'])) $strCountry = addslashes(implode(',',$_REQUEST['country'])); else $strCountry = NULL; in files: inc_savestore.php and inc_updatestore.php Thank you it worked like a charm!, I still got alot to do to make this just right. However you taught me in this process as well and I cannot thank you enough for it. Those two files is what made that much of a difference and the implode function. Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-962234 Share on other sites More sharing options...
winuser2003 Posted November 21, 2009 Author Share Posted November 21, 2009 change if (isset($_REQUEST['country'])) $strCountry = addslashes($_REQUEST['country']); else $strCountry = NULL; to if (isset($_REQUEST['country'])) $strCountry = addslashes(implode(',',$_REQUEST['country'])); else $strCountry = NULL; in files: inc_savestore.php and inc_updatestore.php Thank you it worked like a charm!, I still got alot to do to make this just right. However you taught me in this process as well and I cannot thank you enough for it. Those two files is what made that much of a difference and the implode function. One Question why is it doing this ?? Not listing all the Occasions for some reason... Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-962272 Share on other sites More sharing options...
winuser2003 Posted November 21, 2009 Author Share Posted November 21, 2009 change if (isset($_REQUEST['country'])) $strCountry = addslashes($_REQUEST['country']); else $strCountry = NULL; to if (isset($_REQUEST['country'])) $strCountry = addslashes(implode(',',$_REQUEST['country'])); else $strCountry = NULL; in files: inc_savestore.php and inc_updatestore.php Thank you it worked like a charm!, I still got alot to do to make this just right. However you taught me in this process as well and I cannot thank you enough for it. Those two files is what made that much of a difference and the implode function. One Question why is it doing this ?? Not listing all the Occasions for some reason... Sasa - To make things a little easier and not to blow up the forum LOL, I decided to make a video that shows a little better understanding as to what it going on. I am also learning alot and I do appreciate and am very thankful for your time in this. Honestly I should pay you!! LOL Please take the time to view the video, and I am also providing a link to the updated files. I applied some changes to the scripts and I thought maybe you would download and check them out. I wish I did not have to eliminate the "Country" setting though and replace it with "Occasions". I tried to analyze how states was setup and attempt the same process, but it said something about having too many entries in the database. Everything is in the zip file to check out. I am going to keep researching and googling. Video Link: http://www.bookapartyroom.com/video/vid2/index.html Zip File Link: http://www.bookapartyroom.com/video/vid2/store.zip Thank You Again for Everything! Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-962471 Share on other sites More sharing options...
delickate Posted November 21, 2009 Share Posted November 21, 2009 Could you please provide us inc_security.php file code and its database dump.? So that we might be go through what is going on. Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-962502 Share on other sites More sharing options...
winuser2003 Posted November 21, 2009 Author Share Posted November 21, 2009 Could you please provide us inc_security.php file code and its database dump.? So that we might be go through what is going on. Click on the zip file link if you do not see it here is the link again.. Zip File: www.bookapartyroom.com/video/vid2/store.zip Download this zip file. It has everything you need, including the sql file to import the database over and review. Be sure to change the settings.php to match your own server information. Video of Questions: http://www.bookapartyroom.com/video/vid2/index.html A video of the interface and the questions I have in regards to the issues I am having. I figured this would be alot easier than posting over and over, you get an interactive look. The whole project is small, I think 170kb. The download would be quick and setup would not take that long. Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-962679 Share on other sites More sharing options...
sasa Posted November 22, 2009 Share Posted November 22, 2009 in your database type of country field is varchar(50) change it to varchar(100) Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-963040 Share on other sites More sharing options...
winuser2003 Posted November 22, 2009 Author Share Posted November 22, 2009 in your database type of country field is varchar(50) change it to varchar(100) Did you get a chance to look at the zip file and the video? I cannot believe I missed that, trust me I am not a dumb a$$ LOL, I should have caught that. Changing the number of characters in the database (duh!). Well, now my next task is to get the "save store" button to not only submit its data to the DB but also send a confirmation email that a store has been created. What are your thoughts on that? Thank you again by the way. Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-963386 Share on other sites More sharing options...
winuser2003 Posted November 23, 2009 Author Share Posted November 23, 2009 in your database type of country field is varchar(50) change it to varchar(100) Did you get a chance to look at the zip file and the video? I cannot believe I missed that, trust me I am not a dumb a$$ LOL, I should have caught that. Changing the number of characters in the database (duh!). Well, now my next task is to get the "save store" button to not only submit its data to the DB but also send a confirmation email that a store has been created. What are your thoughts on that? Thank you again by the way. There are two files I think that hold this static link. The common.php and the inc_savestore.php. I cannot find where the link is attached though. I have tried creating new stores, and once I create them I got the message "Party Room Saved" however that is still hyperlinked. If you need more detail take a look at the video link I provided. I will keep working with this. Thank You again, and let me know your thoughts. Quote Link to comment https://forums.phpfreaks.com/topic/181903-probably-easy-need-help-with-check-boxes-in-php-code/#findComment-963665 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.