Jump to content

Contact form help: may be weird


samuraibsd

Recommended Posts

Hi, all

 

This is my first post, so please go easy on me ;)

 

I've got a little problem.  I have a PHP upload form that works flawlessly, but I need a contact form to go with it.  I'd like to have fields for Name, email address and message.  That in itself isn't hard, but what I'm unsure of is how to attach the file upload script to the contact form in such a way that the email is sent to the address, and the file is uploaded to a specific server – that is, NOT sent as an attachment with the email (these files are rather large, though I'm capping it off at 200 MB).  I'd also like to have the email sent read something like "[the file] was sent by [sender's name] from [sender's email]"  I think I know how to do that bit, but just in case I'm wrong, you know?

 

Any help is appreciated, thanks guys!

Link to comment
Share on other sites

Well just incorporate the required fields for the email and add them to your current uploading form and then just add in the mail function in your script.

ex form:

Name:<input type="text" name="name" maxlength="50" /><br />
Email:<input type="text" name="email" maxlength="100" /><br />
<textarea name="message"></textarea><br />
File:<input type="file" name="file" /><br />
<input type="submit" name="upload" value="upload" />

 

Then just add the appropriate variables and functions to your upload script, which will most likely have the following format

<?php 
if(isset($_POST['upload'])){
being uploading file

/*now add in the part for the email*/
$to = $_POST['emai'];
$subject = "Download file!";
$message = $_POST['message'];
$message .= "The {$filename} was sent by {$_POST['name']} from {$_POST['email']}";
$headers = "From: $_POST['name']";

//lets mail it
mail($to,$subject,$message,$headers);
}

Very basic example, but I think it will show you the point. If not, post your code and I can help you further.
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.