So I have made some changes and the following code uses a dropdown instead of radio buttons. But the script I am using http://www.agitprop.org.au
<!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" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>Custom contact page</title>
<script type="text/javascript">
function chkContacts(ele) {
var div = document.getElementById('contactList');
div.innerHTML = "";
for (var i=1; i<=ele; i++) {
addContact(i, div);
}
div.style.display = "";
}
function addContact(num, div) {
var contact = document.createElement('p');
var textName1 = document.createTextNode('#' + num + ' Last Name: \n\n');
var contactLastName = document.createElement('input');
contactLastName.type = 'text';
contactLastName.name = 'contactLastName' + num;
contactLastName.id = 'contactLastName' + num;
var br = document.createElement('br');
var textName = document.createTextNode('#' + num + ' First Name: \n');
var contactFirstName = document.createElement('input');
contactFirstName.type = 'text';
contactFirstName.name = 'contactFirstName' + num;
contactFirstName.id = 'contactFirstName' + num;
var br = document.createElement('br');
//dynamic creation of the email element
var textEmail = document.createTextNode('#' + num + ' Email: \n');
var contactEmail = document.createElement('input');
contactEmail.type = 'text';
contactEmail.name = 'contactEmail' + num;
contactEmail.id = 'contactEmail' + num;
//dynamic creation of the drop down element
var textSelect = document.createTextNode('#' + num + ' Golf Score: \n');
var oSelect=document.createElement("select");
var oOption = document.createElement("option");
var t0 = document.createTextNode("Option 1");
oOption.id = 'oOption' + num;
var oOption1 = document.createElement("option");
var t1 = document.createTextNode("Option 2);
// adds options to the drop down menu
oOption.appendChild(t0);
oOption1.appendChild(t1);
oSelect.appendChild(oOption);
oSelect.appendChild(oOption1);
// add options to form
contact.appendChild(textSelect);
contact.appendChild(oSelect);
//br
var br=document.createElement("br");
contact.appendChild(br);
contact.appendChild(textName);
contact.appendChild(contactLastName);
//br
var br=document.createElement("br");
contact.appendChild(br);
contact.appendChild(textName1);
contact.appendChild(contactFirstName);
//br
var br=document.createElement("br");
contact.appendChild(br);
contact.appendChild(textEmail);
contact.appendChild(contactEmail);
div.appendChild(contact);
}
</script>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
#contactList{
text-align: right;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form action="catchall_mail.php" method="POST">
<table border="1" cellpadding="5">
<tr>
<td colspan="2"><table class="Normal" cellSpacing="0" cellPadding="2" width="100%" border="0">
<tr>
<td width="300" align="right">Last Name: </td>
<td align="left" vAlign="top"><input type="text" name="txtLastName" id="txtLastName"></td>
</tr>
<tr>
<td align="right">First Name: </td>
<td vAlign="top"><input type="text" name="txtFirstName" id="txtFirstName"></td>
</tr>
<tr>
<td align="right">Mailing Address: </td>
<td vAlign="top"><textarea name="textareaMailing" id="textareaMailing" cols="45" rows="5"></textarea></td>
</tr>
<tr>
<td align="right">City: </td>
<td vAlign="top"><input type="text" name="txtCity" id="txtCity"></td>
</tr>
<tr>
<td align="right">Province: </td>
<td vAlign="top"><select name="ddProvince" id="ddProvince">
<option value="Alberta">Alberta</option>
<option value="British Columbia">British Columbia</option>
<option value="Manitoba">Manitoba</option>
<option value="New Brunswick">New Brunswick</option>
<option value="Newfoundland">Newfoundland</option>
<option value="Nova Scotia">Nova Scotia</option>
<option value="Ontario">Ontario</option>
<option value="Prince Edward Island">Prince Edward Island</option>
<option value="Quebec">Quebec</option>
<option value="Saskatchewan">Saskatchewan</option>
<option value="Northwest Territories">Northwest Territories</option>
<option value="Nunavut">Nunavut</option>
<option value="Yukon">Yukon</option>
</select></td>
</tr>
<tr>
<td align="right">Postal Code: </td>
<td vAlign="top"><input type="text" name="txtPostal" id="txtPostal"></td>
</tr>
<tr>
<td align="right">Employer: </td>
<td vAlign="top"><input type="text" name="txtEmployeer" id="txtEmployeer"></td>
</tr>
<tr>
<td align="right">Position Title: </td>
<td vAlign="top"><input type="text" name="txtPositionTitle" id="txtPositionTitle"></td>
</tr>
<tr>
<td align="right">Business Phone: </td>
<td vAlign="top"><input type="text" name="txtBusinessPhone" id="txtBusinessPhone">
</td>
</tr>
<tr>
<td align="right">Email Address: </td>
<td vAlign="top"><input type="text" name="txtEmail" id="txtEmail"></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><TABLE class="Normal" width="100%" border="0">
<TR>
<TD width="300" align="right" vAlign="top" class="Normal">Please indicate your
usual 18-hole golf score below:</TD>
<TD vAlign="top" align="left" width="170"><table id="table" class="Normal" border="0">
<tr>
<td><p>
<label>
<input name="GolfScore" type="radio" id="GolfScore_0" value="Never Played" checked>
Never Played</label>
<br>
<label>
<input type="radio" name="GolfScore" value="Played a few times" id="GolfScore_1">
Played a few times</label>
<br>
<label>
<input type="radio" name="GolfScore" value="120+" id="GolfScore_2">
120+</label>
<br>
<label>
<input type="radio" name="GolfScore" value="111-120" id="GolfScore_3">
111-120</label>
<br>
<label>
<input type="radio" name="GolfScore" value="101-110" id="GolfScore_4">
101-110</label>
<br>
<label>
<input type="radio" name="GolfScore" value="90-100" id="GolfScore_5">
90-100</label>
<br>
<label>
<input type="radio" name="GolfScore" value="Under 90 (Please specify)" id="GolfScore_6">
Under 90 (Please specify)</label>
<br>
</p></td>
</tr>
</table></TD>
<TD vAlign="bottom" align="left"><input name="txtGolfScore" type="text" id="Over90" /></TD>
</TR>
</TABLE></td>
</tr>
<tr>
<td colspan="2">How many other people are you registering?</td>
</tr>
<tr>
<td> </td>
<td><select name="nContacts" onchange="chkContacts(this.value);">
<option value="0">--Choose--</option>
<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>
</select>
<br />
<br />
<div id="contactList" style="display: none;"></div>
<br />
<br /></td>
</tr>
<tr>
<td colspan="2"><div align="right">
<input name="RSVP" type="submit" class="formbutton11" value="Submit" />
</div></td>
</tr>
</table>
</form>
</body>
</html>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232:





by: InnerChildPosted on 2008-04-28 at 11:53:51ID: 21456582
OK I have been working away and I can pass the infomration along but it is tedious beause the form element name is attached dynamically as well so as an example if I have a form element that is txtFirstName in my PHP I have to pass the following varialbes to catch everything...
txtFirstName1
txtFirstName2
txtFirstName3
txtFirstName4
txtFirstName5
txtFirstName6
txtFirstName7
txtFirstName8
which also generates a mostly empty email.
Now I was also able to scratch together a radio function but the problem I am having with that is that is that it is acting as one giant raio group. I could switch it to another drop down if that makes things easier.
Hope this helps,
IC
Select allOpen in new window