Probably Easy, Need help with Check Boxes in PHP Code


Posted on 16th Feb 2014 07:03 pm by admin

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..
Code: 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...
Code: 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">&nbsp;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">&nbsp;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">&nbsp;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">&nbsp;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">&nbsp;State</td>n");
print(" <td class="newtext">");

include ("statedropdown.php");

print(" <tr>n");
print(" <td class="newhead">&nbsp;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">&nbsp;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">&nbsp;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">&nbsp;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">&nbsp;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">&nbsp;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">&nbsp;Party Occasions</td>n");
print(" <td class="newtext">");

countrydropdown();

print(" <tr>n");
print(" <td class="newhead">Description of <br/>Party Room
Kid Friendly
Wi-Fi Access
Or Other Features
</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>
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">&nbsp;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("
n");
print("Other hours information
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>
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">&nbsp;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">&nbsp;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">&nbsp;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>
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">&nbsp;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>&nbsp;</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...
Code: 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">&nbsp;Store ID</td>n");
print(" <td class="viewtext">{$row['storeID']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Capacity</td>n");
print(" <td class="viewtext">{$row['companystoreID']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Store Name</td>n");
print(" <td class="viewtext">{$row['storename']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Address</td>n");
print(" <td class="viewtext">{$row['address']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;City</td>n");
print(" <td class="viewtext">{$row['city']}</td>n");
print(" </tr>n");
print(" <td class="viewhead">&nbsp;State</td>n");
print(" <td class="viewtext">{$row['statename']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Zip / Post Code</td>n");
print(" <td class="viewtext">{$row['zippostcode']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Telephone 1</td>n");
print(" <td class="viewtext">{$row['telephone1']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Telephone 2</td>n");
print(" <td class="viewtext">{$row['telephone2']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Fax</td>n");
print(" <td class="viewtext">{$row['fax']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;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">&nbsp;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">&nbsp;Party Occasion</td>n");
print(" <td class="viewtext">{$row['country']}</td>n");
print(" </tr>n");
print(" <td class="viewhead">&nbsp;Description of <br/>Party Room
Kid Friendly
Wi-Fi Access
Or Other Features
</td>n");
print(" <td class="viewtext">{$row['description']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;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("
n");
print("Other hours information
n");
print $row['opencloseinfo'];

print("</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Store Manager</td>n");
print(" <td class="viewtext">{$row['storemanager']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;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">&nbsp;Directions</td>n");
print(" <td class="viewtext">{$row['directions']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;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">&nbsp;Last Modified</td>n");
print(" <td class="viewtext">{$row['recordlastmodified']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Last Modified By</td>n");
print(" <td class="viewtext">{$row['recordlastmodifiedby']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;Created</td>n");
print(" <td class="viewtext">{$row['recordcreated']}</td>n");
print(" </tr>n");
print(" <tr>n");
print(" <td class="viewhead">&nbsp;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...
Code: print

(" <tr>n");
print(" <td class="viewhead">&nbsp;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

No comments posted yet

Your Answer:

Login to answer
197 Like 32 Dislike
Previous forums Next forums
Other forums

Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou

PHP referral database. I would like this form to email the referrer.
Okay, Hello I've been trolling for years. This the first time I've ever asked for php help. Normally

parsing error
can anyone explain this syntax error:

Parse error: syntax error, unexpected T_IF

The e

pspell
using pspell, is it possible to get words that would be best in the current phrase?

For examp

Good Programming and Web Design Books
Hi,

I recived a pm today from a fellow phpfreaker regarding php books, i replied with the fo

Help with echo()
I'm having some problems with this code:

Code: echo '
<A HREF="jav

Dynamic Array using glob?
Is there an easier way to do this?

I am trying to get create a dyamic array based on files wi

error checking breaking my code
Hi there, OK first of all, big apologies for what I assume is really fundamental errors in the struc

how to configure ADS in ABAP instance
Hi All,

I am working on r/3 4.7 ABAP system.Can we configure ADS(adobe document services)

show the direct link into href
I want to display link on the page. i am fetching the data(URL) from database,actually before that i

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash