0

I have a stress that I will really appreciate fast response. I have a form as below and I need the action script in php.

<?php
      $msg = "Message from Platform Form\n";
      $msg .= "Aspirant's Background:\t$_POST[aspirant_background]\n";
      $msg .= "Aspirant's choice:\t$_POST[aspirant_choice]\n";
      $msg .= "Aspirant's Offer:\t$_POST[aspirant_offer]\n";
      $msg .= "Aspirant's email:\t$_POST[aspirant_email]\n";
      [B]$msg .= "Aspirant's Photo:\t$_POST[aspirant_photo]\n";[/B]
      $to = "info@helegrow.com";
      $subject = "Platform Submission";
      $mailheaders = "From: The site <> \n";
      $mailheaders .= "Reply-To: $_POST[sender_email]\n\n";
      mail($to, $subject, $msg, $mailheaders);
      ?>

The line I made bold and colored is the spot. I want that line to pick a picture from the use but I just can't do it.


Please I really need it.Your can tryout the site a see the form. www.youngvotersinitiative.org

3
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by sparkles_links
0

I'm not sure if this is what you mean but you might want to try adding
<input type='file' name='photo'> on your form. This input type allows the user to browse and select a picture.

1

$_POST[aspirant_photo] doesn't mean uploaded image will be directly attached..

you have to upload that photo to the server using move_uploaded_file.
Then you can give <img src="url of uploaded photo"> in message.

Votes + Comments
You are the MAM
1

create new folder at root named : 'upload'.
Place below code for mail sending.

<?php 

$msg = "Message from Platform Form\n";
$msg .= "Aspirant's Background:\t$_POST[aspirant_background]\n";
$msg .= "Aspirant's Position:\t$_POST[aspirant_email3]\n";
$msg .= "Aspirant's Offer:\t$_POST[aspirant_email2]\n";
$msg .= "Aspirant's email:\t$_POST[aspirant_email]\n";

$fname = $_FILES['aspirant_photo']['name'];		
$uploadfile = 'upload/'.$fname;
if(move_uploaded_file($_FILES['aspirant_photo']['tmp_name'], $uploadfile)) 
{
	$imgUrl = '<img src="'.'http://www.youngvotersinitiative.org/'.$uploadfile.'">'; 
	$msg .= "Aspirant's Photo:\t".$imgUrl."\n";
}				

$to = "walterosadebe@youngvotersinitiative.org";				
$subject = "Platform Submission";
$mailheaders = "From: Young Voters Initiative <> \n";
$mailheaders .= "Reply-To: $_POST[sender_email]\n\n";
mail($to, $subject, $msg, $mailheaders);

?>

let me know ur output.

0

You are the MAM, it works perfectly. I don't know how to appreciate you. Anyway thanks.

0

Please I just discover something else, The info submitted are on a striaght line, no BR on it

1

code with BR.

<?php 

$msg = "Message from Platform Form<br />";
$msg .= "Aspirant's Background:\t $_POST[aspirant_background]<br />";
$msg .= "Aspirant's Position:\t $_POST[aspirant_email3]<br />";
$msg .= "Aspirant's Offer:\t $_POST[aspirant_email2]<br />";
$msg .= "Aspirant's email:\t $_POST[aspirant_email]<br />";

$fname = $_FILES['aspirant_photo']['name'];		
$uploadfile = 'upload/'.$fname;
if(move_uploaded_file($_FILES['aspirant_photo']['tmp_name'], $uploadfile)) 
{
	$imgUrl = '<img src="'.'http://www.youngvotersinitiative.org/'.$uploadfile.'">'; 
	$msg .= "Aspirant's Photo:\t ".$imgUrl."<br />";
}				

$to = "walterosadebe@youngvotersinitiative.org";				
$subject = "Platform Submission";
$mailheaders = "From: Young Voters Initiative <> \n";
$mailheaders .= "Reply-To: $_POST[sender_email]\n\n";
$mailheaders .= "MIME-Version:1.0\nContent-type:text/html; charset=ISO-8859-1\n";
mail($to, $subject, $msg, $mailheaders);

?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.