Jump to content

Archived

This topic is now archived and is closed to further replies.

theteenb

I don't know what to add to make it work...

Recommended Posts

Ok I have a submission form that sends information to an email address for my site... I want to add an upload form so that they can put images on it as well... what do I need to add to my php code to accomplish this?  ??? This is the php code that I already have for the form...

[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><meta HTTP-EQUIV="REFRESH" content="7; url=main.html">

<head>
  <title>Custom Contact Form</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
body {
background-image: url(content.jpg);
}
-->
</style><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<DIV ALIGN="center"><BODY>
<TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" class="style1">
<TR>
<TD>
<?php
//change to your email address
$youremail = "submit@theteenbulletin.com";
@extract($_POST);
$name = stripslashes($name);
$email = stripslashes($email);
$subject = stripslashes($subject);
$message = stripslashes($message);
$age = stripslashes($age);
$city = stripslashes($city);
$country = stripslashes($country);
// below is the text of the email you will receive, change to suit your needs
$msg = "
Age: $age, City: $city, Country: $country, Submitted Text: $message
";
$validstring = '^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3}))$';
if (!eregi($validstring,$email)&&$email) {
$emailcorrect = 0;
}
else  {
$emailcorrect = 1;
}
if($email&&$subject&&$name&&$message&&$emailcorrect) {
if(mail($youremail, $subject, $msg, "From: $name <$email>")) {
echo "<br><br><br><br><br><br><br>Your story was submitted. <br>Thank you $name, for the piece.<br><br>You will receive a reply confirming the submission <br> within 24 hours. ";
}
}
//These are the required fields your vistor must fill in
if(!$email||!$subject||!$name||!$message) {
echo  "<br><br><br><br><br><br><br>Sorry, $name, <br>your piece was not submitted<br> you have forgotten to fill in a detail(s).";
}
if (!$emailcorrect) {
echo "<br><br><br><br><br><br><br>Sorry, $name, <br>your e-mail address is not valid.";
}
?>
</TD>
</TR>
</TABLE>

</DIV>
<div align="center"><span class="style1">If this page does not redirect then <a href="main.html">click here</a>. </span></div>
</body>
</html>[/code]

And this is the html for the form which I included the upload form code in here...
[code]<!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=iso-8859-1" />
<title>The Teen Bulletin :: Submit Your Own</title>
<style type="text/css">
<!--
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif}
body {
background-image: url(content.jpg);
}
-->
</style>
</head>

<body>
<p class="style2" align="right"><i><b><font size="6" face="Courier New">Submit
Your </font></b></i><b><i><font face="Courier New" size="6">Work</font></i></b></p>
<p class="style2">&nbsp;</p>
<p class="style2">You can submit your own work to The Teen Bulletin by using the form below. </p>
<p class="style2">&nbsp;</p>
<form action="contactprocess.php" method="post" enctype="multipart/form-data">
  <p class="style2">Name (e.g. John S):
      <input type="text" name="name" size="50" maxlength="50" />
  </p>
  <p class="style2">Email:
    <input type="text" name="email" size="50" maxlength="50" />
  Age:
    <label>
    <input name="age" type="text" id="age" size="3" maxlength="2" />
    </label>
  </p>
  <p class="style2">City, State/Province:
    <input name="city" type="text" id="city" size="50" maxlength="50" />
  </p>
  <p class="style2">Country:
    <input name="country" type="text" id="country" size="50" maxlength="50" />
  </p>
<p class="style2">Title:
      <input type="text" name="subject" size="50" maxlength="50" />
  </p>
<p class="style2">Image:<input type="file" name="F1" size="48"></p>
  <p class="style2">Piece:
      <textarea name="message" rows="10" cols="60"></textarea>
  </p>
  <p>
    <input type="submit" name="submit" value="Send" />
  </p>
</form>
<p></p>
</body>
</html>[/code]

Share this post


Link to post
Share on other sites
See: [url=http://us3.php.net/manual/en/features.file-upload.php]http://us3.php.net/manual/en/features.file-upload.php[/url]. Explains all you will need to know.

Share this post


Link to post
Share on other sites
Okay I know basically NOTHING about PHP... I can barely edit what was in the code that I originally posted! Could someone just give me the code? There are no usernames or anything on my site. It is a submission form that goes directly to the site's email. If you want to see the submission form to maybe further understand...

http://www.theteenbulletin.com/ and go to the submit your own page...

it doesn't have the file uploader thing on it because I don't have the correct php so the form won't work with it on there unless I have the correct PHP. Please help me out!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.