alright i have 3 pieces of code.
- is the flash code for the form
this is in a MC, that is on a timeline comprises a movie that is being called from another movie. is that as confusing as it sounds? - is the contact.php code
- is the displayResults.php code
i have double checked the labels and the spellings as well as the names of clips. i have been staring at this too long now…any help is appreciated.
- The Actionscript—
submitBtn.onPress = function() {
if(strFirstName.text!="" && strLastName.text!="" && strEmail.text!="" && strAddress.text!="" && strCity.text!="" && strState.text!="" && strZipCode.text!="" && strSubject.text!="" && strMessage.text!=""){
myData = new LoadVars();
myData.strFirstName = strFirstName.text;
myData.strLastName = strLastName.text;
myData.strEmail = strEmail.text;
myData.strAddress = strAddress.text;
myData.strCity = strCity.text;
myData.strState = strState.text;
myData.strZipCode = strZipCode.text;
myData.strSubject = strSubject.text;
myData.strMessage = strMessage.text;
myData.sendAndLoad("contact.php", myData, "POST");
statusBox.text = "Thank You!";
myData.onLoad = function() {
trace(myData.strFirstName+myData.strLastName+myData.strEmail+myData.strAddress+myData.strCity+myData.strState+myData.strZipCode+myData.strSubject+myData.strMessage);
}
strFirstName.text = "";
strLastName.text = "";
strEmail.text = "";
strAddress.text = "";
strCity.text = "";
strState.text = "";
strZipCode.text = "";
strSubject.text = "";
strMessage.text = "";
}else{
statusBox.text = "Fill out all required fields!";
}
}
- The contact.php page
<?php
$userFirstName = $_POST['strFirstName'];
$userLastName = $_POST['strLastName'];
$userEmail = $_POST['strEmail'];
$userAddress = $_POST['strAddress'];
$userCity = $_POST['strCity'];
$userState = $_POST['strState'];
$userZipCode = $_POST['strZipCode'];
$userSubject = $_POST['strSubject'];
$userMessage = $_POST['strMessage'];
$conn = mysql_connect("*hostingServer*", "*userName*", "*password*");
mysql_select_db ("*dataBaseName*", $conn);
$result = mysql_query("INSERT into contacts (FirstName, LastName, Email, Address, City, State, ZipCode, Subject, Message) values ('$userFirstName', '$userLastName', '$userEmail', '$userAddress', '$userCity', '$userState', '$userZipCode', '$userSubject', '$userMessage');
?>
and finally 3) The code to display the results form the DB
<body>
<table width="75%" align="center">
<tr class="row"><td>First Name</td><td>Last Name</td><td>Email</td><td>Address</td><td>City</td><td>State</td><td>Zip Code</td><td>Message</td></tr>
<?php
$connection = mysql_connect("*hostingServer*", "*userName*", "*password*") or die("Error connecting to database");
mysql_select_db("*dataBaseName*", $connection);
$result = mysql_query("SELECT * FROM contacts ORDER BY id", $connection) or die("error querying database");
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
?>
<tr <?php if($i%2 == 1){ echo "class='body2'"; }else{echo "class='body1'";}?>>
<td>
<?php echo $result_ar['FirstName']; ?></td>
<td>
<?php echo $result_ar['LastName']; ?>
</td>
<td>
<?php echo $result_ar['Email']; ?>
</td>
<td>
<?php echo $result_ar['Address']; ?>
</td>
<td>
<?php echo $result_ar['City']; ?>
</td>
<td>
<?php echo $result_ar['State']; ?>
</td>
<td>
<?php echo $result_ar['ZipCode']; ?>
</td>
<td>
<?php echo $result_ar['Message']; ?>
</td>
</tr>
<?php
$i+=1;
}
?>
</table>
</body>
Thanks Again!