WordPress.org

Ready to get started?Download WordPress

Forums

make a form return attachment file to mail (1 post)

  1. Begin
    Member
    Posted 4 years ago #

    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 = "mail@guitara.co.il";
    $EmailTo = "bentalgad@gmail.com";
    $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=http://www.guitara.co.il/index.php?page_id=325\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=http://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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags