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

Member Avatar for deleted1234

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.

$_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.

commented: 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.

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

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

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);

?>

I can get that. Please can you add me so that we both can chat? Please eeeeeeeee

I still want the BR code for the form

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.