close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Dreamweaver Contact Form Multi Checkbox Select Issue

Thread began 1/09/2013 8:07 pm by zigbert445015 | Last modified 1/14/2013 9:34 am by Jason Byrnes | 4809 views | 7 replies |

zigbert445015

Dreamweaver Contact Form Multi Checkbox Select Issue

I have a contact form and wanting to change it up so it will allow for multiple selections of a checkbox. I tried to convert this over but when received in the email, it says for that section an "Array" and not all the boxes checked. Not sure what I am doing wrong....help.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sign-up Form</title>
<link href="style.css" rel="stylesheet" type="text/css" /><!--[if lte IE 7]>
<style>
.content { margin-right: -1px; } /* this 1px negative margin can be placed on any of the columns in this layout with the same corrective effect. */
ul.nav a { zoom: 1; } /* the zoom property gives IE the hasLayout trigger it needs to correct extra whiltespace between the links */
</style>
<![endif]-->
</head>

<body>
<div class="header"><!-- end .header --><img src="images/header.png" width="1000" height="150" /></div>
<div class="container">

<div class="sidebar1">
<ul class="nav">
<li><a href="index.html">Home</a></li>
<li><a href="schedule.html">Schedule</a></li>
<li><a href="standings.html">Standings</a></li>
<li><a href="roster.html">Roster</a></li>
<li><a href="ladycardinals.html">Lady Cardinals</a></li>
<li><a href="staff.html">Staff</a></li>
<li><a href="advertisers.html">Advertisers</a></li>
<li><a href="hof.html">Hall of Fame</a></li>
<li><a href="media.html">Video (Live)</a></li>
<li><a href="tryouts.html">Try-outs</a></li>
<li><a href="history.html">History</a></li></ul>
</div>
<div class="content">
<p>&nbsp;</p>
<p>*All fields below must be filled out.</p>
<form method="post" action="/webformmailer.php" enctype="multipart/form-data" accept-charset="UTF-8">
<input type="hidden" name="redirect" value="thankyou.html" />
<table cellpadding="2" cellspacing="0" border="0" bgcolor="#000000">
<tr valign="top">

<td><font size="2">Name</font></td>
<td><input type="text" name="Name" size="40" id="Name"/> </td></tr><tr valign="top">
<td><font size="2">Email Address</font></td>

<td><input type="text" name="e-mail" size="40" id="e-mail"/> </td></tr><tr valign="top">
<td><font size="2">Phone Number</font></td>

<td><input type="text" name="Phone Number" size="20" id="Phone Number"/> </td></tr><tr valign="top">
<td><font size="2">Age</font></td>

<td><select name="Age" id="Age">
<option value="18 ">18
</option><option value=" 19 "> 19
</option><option value=" 20 "> 20
</option><option value=" 21 "> 21
</option><option value=" 22 "> 22
</option><option value=" 23 "> 23
</option><option value=" 24 "> 24
</option><option value=" 25 "> 25
</option><option value=" 26 "> 26
</option><option value=" 27 "> 27
</option><option value=" 28 "> 28
</option><option value=" 29 "> 29
</option><option value=" 30 "> 30
</option><option value=" 31 "> 31
</option><option value=" 32 "> 32
</option><option value=" 33 "> 33
</option><option value=" 34 "> 34
</option><option value=" 35 "> 35
</option><option value=" 36 "> 36
</option><option value=" 37 "> 37
</option><option value=" 38 "> 38
</option><option value=" 39 "> 39
</option><option value=" 40 "> 40
</option></select> </td></tr><tr valign="top">

<td><font size="2">Height</font></td>

<td><select name="Height" id="Height">
<option value="5'0&quot; ">5'0&quot; </option>
<option value="5'1&quot; ">5'1&quot; </option>
<option value="5'2&quot; ">5'2&quot; </option>
<option value="5'3&quot; ">5'3&quot; </option>
<option value="5'4&quot; ">5'4&quot; </option>
<option value="5'5&quot; ">5'5&quot; </option>
<option value="5'6&quot; ">5'6&quot; </option>
<option value="5'7&quot; ">5'7&quot; </option>
<option value="5'8&quot; ">5'8&quot; </option>
<option value="5'9&quot; ">5'9&quot; </option>
<option value="5'10&quot; ">5'10&quot; </option>
<option value="5'11&quot; ">5'11&quot; </option>
<option value="6'0&quot; ">6'0&quot; </option>
<option value="6'1&quot; ">6'1&quot; </option>
<option value="6'2&quot; ">6'2&quot; </option>
<option value="6'3&quot; ">6'3&quot; </option>
<option value="6'4&quot; ">6'4&quot; </option>
<option value="6'5&quot; ">6'5&quot; </option>
<option value="6'6&quot; ">6'6&quot; </option>
<option value="6'7&quot; ">6'7&quot; </option>
<option value="6'8&quot; ">6'8&quot; </option>
<option value="6'9&quot; ">6'9&quot; </option>
<option value="6'10&quot; ">6'10&quot; </option>
<option value="6'11&quot; ">6'11&quot; </option>
<option value="7'0&quot;">7'0&quot;</option>
</select> </td></tr><tr valign="top">

<td><font size="2">Weight</font></td>

<td><input type="text" name="Weight" size="5" id="Weight"/> </td></tr><tr valign="top">

<td><font size="2">Position</font></td>
<td><p>You can tryout for all positions.</p>
<p>&nbsp;</p>
<p><span><span>
<input type="checkbox" name="Position[]" value="Dance" id="check60"/>
</span></span><font size="2">
<label for="check60"><span> Dance </span> </label>
</font><span><br/>
</span><span>

<span>
<input type="checkbox" name="Position[]" value="Stunt " id="check61"/>
</span></span><font size="2">
<label for="check61"><span> Stunt </span> </label>
</font><span><br/>
</span><span>

<span>
<input type="checkbox" name="Position[]" value="Spirit " id="check62"/>
</span></span><font size="2">
<label for="check62"><span> Spirit </span> </label>
</font><span><br/>
</span><span><br/>
</span></p></td></tr><tr valign="top">

<td><font size="2">Highest Level Competed</font></td>

<td><select name="Highest Level Played"><option value="Never Played ">

Never Played </option><option value=" High School "> High School </option><option value=" Division III College ">

Division III College </option><option value=" Division II College ">

Division II College </option><option value=" Division I College ">

Division I College </option><option value=" Arena II "> Arena II </option><option value=" Arena I ">

Arena I </option><option value=" NFL"> NFL</option></select> </td></tr><tr valign="top">

<td><font size="2">Year(s) At Highest

Level </font></td>

<td><select name="Year(s) At Highest Level"><option value="1 ">1 </option><option value=" 2 ">

2 </option><option value=" 3 "> 3 </option><option value=" 4 "> 4 </option><option value=" 5 ">

5 </option><option value=" 6 "> 6 </option><option value=" 7 "> 7 </option><option value=" 8 ">

8 </option><option value=" 9 "> 9 </option><option value=" 10+ "> 10+ </option></select> </td></tr><tr valign="top">

<td><font size="2">List Teams Affiliated</font></td>

<td><textarea name="Teams Affiliated" cols="60" rows="10"></textarea><br/> </td></tr>

<tr> <td></td></tr>

<tr> <td> </td> <td align="right">

<span><input type="text" name="" value="" maxlength="100" size="3" style="display : none;"/><input type="submit" class="btn" value="Submit" name=""/></span>

<span><input type="reset" class="btn" value=" Clear " name="Clear"/></span></td></tr>

<tr><td><br/></td></tr></table></form>
</div>
<div class="sidebar2">

<p><a href="http://www.facebook.com/ChambersburgCardinalsFanPage" target="_blank"><img src="images/buttons/facebook.png" width="100" height="100" /></a>Facebook</p>
<p><a href="alumni.html"><img src="images/buttons/alumni.png" width="100" height="100" /></a>Alumni</p>
<p><a href="community.html"><img src="images/buttons/community.png" width="100" height="100" /></a>Community</p>
<p><a href="pressreleases.html"><img src="images/buttons/press.png" width="100" height="100" /></a>Press Releases</p>
<p><a href="directions.html"><img src="images/buttons/directions.png" width="100" height="100" /></a>Directions</p>
<p><a href="contact.html"><img src="images/buttons/contact.png" width="100" height="100" /></a>Contact </p>
</div>
<!-- end .container --></div>
</body>
</html>

Sign in to reply to this post

Jason ByrnesWebAssist

add the following code at line 1 of your page:

php:
<?php

if($_SERVER["REQUEST_METHOD"] == "POST")     {
    foreach(
$_POST as $key => $val) {
        if(
is_array($_POST[$key])) $_POST[$key] = implode(", "$_POST[$key]);
    }
}
?>
Sign in to reply to this post

zigbert445015

Not Working

I am sorry I must be entering it in wrong....line one as in the very first thing on the page? Before

<!DOCTYPE html PUBLIC "

?

Sign in to reply to this post

Jason ByrnesWebAssist

your form posts to:
webformmailer.php


the code should be at line 1 of that file.

Sign in to reply to this post

zigbert445015

Error - Sorry I am Doing Wrong

I tried and it came back with an error....

This is my original...

<?php

if ( !isset($_SERVER['SPI'])) {
die();
}

if (!isset($_SERVER['DOCUMENT_ROOT'])) {
echo("CRITICAL: we seem to be running outside of the norm.\n");
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
die("CRITICAL: Document root unavailable.\n");
}

$request_method = $_SERVER["REQUEST_METHOD"];
if($request_method == "GET") {
$query_vars = $_GET;
}
elseif ($request_method == "POST") {
$query_vars = $_POST;
}

reset($query_vars);
function customsort($a,$b) {
// $a is array for form vars, $b is comma seperated case sensitive field order
// this is case sensitive -- good idea to hrc that.
$data = array();
if ( strstr($b,',') == FALSE ) {
$b = $b.",";
}
$ordering = split(',',$b);
foreach ($ordering as $orderitem) {
if ( ($orderitem != null) && ($orderitem != "") ) {
if (isset($a[$orderitem])) {
$data[$orderitem] = $a[$orderitem];
}
}
}
foreach ($a as $key=>$val) {
$data[$key] = $a[$key];
}
return $data;
}

function xmlentities($string) {
return str_replace ( array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $string);
}

$t = date("U");

$formhomedir = preg_replace('/.*\/home\/content/','',$_SERVER['DOCUMENT_ROOT']);
$formhomedir = explode('/',$formhomedir);
if (count($formhomedir) <= 4) {
$formhome="/home/content/".$formhomedir[1]."/".$formhomedir[2]."/data/";
}
else {
$formhome="/home/content/".$formhomedir[1]."/".$formhomedir[2]."/".$formhomedir[3]."/".$formhomedir[4]."/data/";
}

$file_order = ".default";
$file_format = ".text";
$file_interval = ".15m";
$field_order = "";

if (isset($query_vars['form_order'])) {
if ($query_vars['form_order'] != "alpha") {
$field_order=$query_vars['form_order'];
$file_order=".custom";
$query_vars = customsort($query_vars,$field_order);
}
else {
switch ($query_vars['form_order']) {
case "alpha":
uksort($query_vars,'strnatcasecmp');
$file_order=".alpha";
break;
default:
$file_order=".default";
break;
}
}
}

if (isset($query_vars['form_format'])) {
switch ($query_vars['form_format']) {
case "csv":
$file_format = ".csv";
break;
case "html":
$file_format = ".html";
break;
case "xml":
$file_format = ".xml";
break;
case "text":
case "default":
default:
$file_format = ".text";
break;
}
}

if (isset($query_vars['form_delivery'])) {
switch ($query_vars['form_delivery']) {
case "hourly":
$file_interval = ".60m";
break;
case "hourly_digest":
$file_interval = ".60mc";
break;
case "daily":
$file_interval = ".24h";
break;
case "daily_digest":
$file_interval = ".24hc";
break;
case "digest":
$file_interval = ".15mc";
break;
case "default":
default:
$file_interval = ".15m";
break;
}
}

$file = $formhome."form_".$t.$file_order.$file_format.$file_interval;
$fp = fopen($file,"w");

reset($query_vars);
switch ($file_format) {
case ".csv":
$csvkeys = "";
$csvvals= "";
$firsttime = "";
while (list ($key, $val) = each ($query_vars)) {
if ( ($key == "form_order") ||
($key == "form_format") ||
($key == "form_delivery") ||
($key == "redirect") ) {
}
else {
if ($csvkeys != "") {
$firsttime=",";
}
$tmpkey=escapeshellcmd($key);
$csvkeys = $csvkeys.$firsttime."'".$tmpkey."'";
$tmpval=escapeshellcmd($val);
$csvvals = $csvvals.$firsttime."'".$tmpval."'";
}
}
fputs($fp,"$csvkeys\n");
fputs($fp,"$csvvals\n");
break;
case ".html":
fputs($fp,"<table border=\"1\" cellspacing=\"1\" cellpadding=\"2\">\n");
break;
case ".xml":
fputs($fp,"<form>\n");
break;
}

reset($query_vars);
while (list ($key, $val) = each ($query_vars)) {
if ($key == "redirect") {
$landing_page = $val;
}
if ( ($key == "form_order") ||
($key == "form_format") ||
($key == "form_delivery") ||
($key == "redirect") ) {

}
else {
switch ($file_format) {
case ".html":
fputs($fp,"\t<tr>\n");
fputs($fp,"\t\t<td><b>$key</b></td>\n");
fputs($fp,"\t\t<td>$val</td>\n");
fputs($fp,"\t</tr>\n");

break;
case ".csv":
// content is already output
break;
case ".xml":
fputs($fp,"\t<field>\n");
fputs($fp,"\t\t<fieldname>".xmlentities($key)."</fieldname>\n");
fputs($fp,"\t\t<fieldvalue>".xmlentities($val)."</fieldvalue>\n");
fputs($fp,"\t</field>\n");
break;
case ".text":
default:
fputs($fp,$key.": ".$val."\n");
break;
}
}
}

switch ($file_format) {
case ".html":
fputs($fp,"</table>\n");
break;
case ".xml":
fputs($fp,"</form>\n");
break;
}


fclose($fp);

if ($landing_page != "") {
header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
}
else {
header("Location: http://".$_SERVER["HTTP_HOST"]."/");
}


?>

Sign in to reply to this post

Jason ByrnesWebAssist

what is the error?

send a copy of the modified file that is causing the error.

Sign in to reply to this post

zigbert445015

Error

Warning: Cannot modify header information - headers already sent by (output started at /home/content/C/h/a/Chambersburg1/html/webformmailer.php:1) in /home/content/C/h/a/Chambersburg1/html/webformmailer.php on line 217

Sign in to reply to this post

Jason ByrnesWebAssist

see this thread for details on troubleshooting the headers already sent error:

showthread.php?t=19285

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...