• I have this form in one of my pages:

    <form method="post" action="wp-content/themes/mguitara/adv_free_engine.php" id="commentForm">
    			<fieldset>
    			<div id="formright">
    
    				<label for="Name">?? ??????:</label>
    				<div class="input-bg">
    					<input type="text" name="Name" id="Name" class="required" minlength="4" />
    				</div>
    
    				<label for="City">???:</label>
    				<div class="input-bg">
    					<input type="text" name="City" id="City" class="required" minlength="4" />
    				</div>
    
    				<label for="Email">??-????:</label>
    				<div class="input-bg">
    					<input type="text" name="Email" id="Email" class="required email" />
    				</div>
    
    				<label for="Phone">?????:</label>
    				<div class="input-bg">
    					<input type="text" name="Phone" id="Phone" class="required phone" />
    				</div>			
    
    				<label for="Price">???? ??????:</label>
    				<div class="input-bg">
    					<input type="text" name="Price" id="Price" class="required price" />
    				</div>
    
    			</div>
    
    			<div id="formleft">
    
    				<label for="Fewlines">?????? ????:</label>
    				<div class="input-bg">
    					<input type="text" name="Fewlines" id="Fewlines" class="required fewlines" />
    				</div>	
    
    				<label for="Message">?????? ???? ??? ???? ?????? ???:</label></td>
    				<div class="message-bg">
    					<textarea name="Message" id="Message" rows="20" cols="20" class="required" minlength="100" ></textarea>
    				</div>
    
    			</div>
    
    				<label for="File">????? ????? (????) :</label></td>
    				<div class="input-bg">
    					<input name="uploaded_file" id="file" type="file" size="16" />
    				</div>
    
    				<div id="send_button">
    				<input type="image" src="wp-content/themes/mguitara/images/send_button.png" name="submit" value="???" class="submit-button" />
    				</div>
    
    			<div id="clear"></div>
    			</fieldset>
    		</form>

    And it goes to this file that make it send as a mail to me:

    <?php
    
    // CHANGE THE VARIABLES BELOW
    
    $EmailFrom = "[email protected]";
    $EmailTo = "[email protected]";
    $Subject = "???? ?????? ???? ?????? ????!";
    
    $Name = Trim(stripslashes($_POST['Name']));
    $City = Trim(stripslashes($_POST['City']));
    $Email = Trim(stripslashes($_POST['Email']));
    $Phone = Trim(stripslashes($_POST['Phone']));
    $Price = Trim(stripslashes($_POST['Price']));
    $Fewlines = Trim(stripslashes($_POST['Fewlines']));
    $Message = Trim(stripslashes($_POST['Message']));  
    
    // prepare email body text
    $Body = "";
    $Body .= "??: ";
    $Body .= $Name;
    $Body .= "\n";
    $Body .= "???: ";
    $Body .= $City;
    $Body .= "\n";
    $Body .= "??-????: ";
    $Body .= $Email;
    $Body .= "\n";
    $Body .= "?????: ";
    $Body .= $Phone;
    $Body .= "\n";
    $Body .= "???? ??????: ";
    $Body .= $Price;
    $Body .= "\n";
    $Body .= "?????: ";
    $Body .= $Fewlines;
    $Body .= "\n";
    $Body .= "??????: ";
    $Body .= $Message;
    $Body .= "\n";
    
    // send email
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>", $file_info);
    
    // redirect to success page
    // CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=https://www.guitara.co.il/index.php?page_id=325\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=https://www.guitara.co.il/index.php?page_id=322\">";
    }
    ?>

    Everything’s working great, except I don’t how to make him
    send me the file that was added as attachment.

    Any one?

  • The topic ‘make a form return attachment file to mail’ is closed to new replies.