I’m getting help from no one with this problem.
I have my own website. So this isn’t for a client or anything. I’m strictly front-end so most of back-end coding is awkward to me. I understand PHP to an extent and that extend isn’t that great.
I want my website contact form to have an upload feature so my clients can upload images to me from my site. I want them to go to my email though - not FTP. I don’t know what to add into my contact form (on the PHP end) to get the upload box to work properly. Can someone PLEASE help me out here?
This is what my form looks like as of now:
<form action="contactthanks.php" method="post">
<table width="377" border="0" cellspacing="15">
<td width="540" align="left"><label for="name">*Name:</label><br /><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td align="left"><label for="city">City:</label><br /><input type="text" name="city" id="city" /></td>
</tr>
<tr>
<td align="left"><label for="email">*Email:</label><br /><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td align="left"><label for="message">*Message:</label><br /><textarea name="message" rows="10" cols="40" id="message"></textarea></td>
</tr>
<td align="left"><label for="answer">*Type in the following answer to the question:<br />2 + 2 =</label><br /><input type="text" name="answer" id="answer" /><br /><br />
<form enctype="multipart/form-data" action="contactthanks.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br /><br />
<input name="submit" type="submit" class="submit-button" onclick="MM_validateForm('name','','R','email','','RisEmail','answer','','RinRange4:4','message','','R');return document.MM_returnValue" value="Submit" />
</form>
</td>
</form>
* are required fields
Obviously, I need to blend both forms together - upload box and my original form. But, for one, I don’t know how to. Do I just remove "form action=“contactthanks.php” method=“post” from the original contact form and replace it with "form enctype=“multipart/form-data” action=“contactthanks.php” method=“POST” to eliminate the other “form”?
Now this is my PHP on the “contactthanks.php” page. I never added ANYTHING into it to try and get the upload feature to work because I don’t have the slightest idea how to.
<body id="body">
<?php
if(isset($_POST['submit'])) {
$to = "to my email - I left my email out";
$subject = "Contact Form";
$name_field = $_POST['name'];
$city_field = $_POST['city'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field
E-Mail: $email_field
City: $city_field
Message:
$message";
echo "";
mail($to, $subject, $body);
} else {
echo "Go back";
}
?>
And of couse underneath all the code is where my Thank you for contacting me is at.
I really hope someone helps me out here because I’m clueless. I know this is probably such a repeticous question but I can’t seem to find an answer anywhere and no one is willing to help me out.