Jump to content

sholla

New Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

sholla's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I want to attach two image files to an email. However, only the first file gets attached. I've tried all sorts of solutions and still I'm always back in the same spot. Pls can someone help me fix this script so that it works? <body> <?php $fileatttype = "image/jpeg"; $fileattname = "sign.jpg"; //check $to_addr = "abc@gmail.com"; $from_addr = "comments@gmail.com"; $subject = "Comments/feedback"; $message = ''; $headers = "From: $from_addr\r\n"; $mimetype = 'multipart/mixed'; $filename = 'photo.jpg'; $ffile = 'uploads/photo.jpg'; $fileatt = "uploads/photo.jpg"; $mimetype2 = 'image/jpeg'; $filename2 = 'sign.jpg'; $ffile2 = 'uploads/sign.jpg'; $fileatt2 = "uploads/sign.jpg"; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $file2 = fopen($fileatt2,'rb'); $data2 = fread($file2,filesize($fileatt2)); fclose($file2); $unique_sep = md5(uniqid(time())); $headers .= "Content-Type: {$mimetype}; ". "name=\"{$filename}\"\n"; $headers .= "Content-Transfer-Encoding: ". "base64\n"; $headers .= chunk_split(base64_encode($data)); $headers .= "Content-Disposition: attachment\n\n"; $headers .= "--$unique_sep--\r\n"; $headers .= "Content-Type: {$mimetype}; ". "name=\"{$filename2}\"\n"; $headers .= "Content-Transfer-Encoding: ". "base64\n"; $headers .= chunk_split(base64_encode($data2)); $headers .= "Content-Disposition: attachment\n\n"; $headers .= "--$unique_sep--"; $success = mail($to_addr, $subject, $message, $headers); if ($success) echo "<strong>Your information have been submited.<br>Thank you.</strong>"; else echo "An error occurred when sending the email to your email address"; ?> </body>
  2. Thanks. I'll keep your updated about my progress
  3. [quote]Thats basically what I have... but when that page loads, there is no $_POST['id']; The form is as such Code: For each entry in db: <form action="" onsubmit="blockSubmit()"> <input type="hidden" id="id" name="hidden" value="<?php echo $id; ?>"> <input type="submit" ...> </form> I know my PHP code works fine (pretty much exactly as you said in the previous post) because when I loaded to page through <form action="page.php?action=delete_message"> it worked fine. Thats why I have posted here, because it is something to do with the AJAX that it doesnt work... Thanks again for the help Tom[/quote] [b]I got it to work! [/b] The problem is not with the form. I changed getPage() as follows: [code] function getPage() { var d1 = document.datain.txt_name.value; var d2 = document.datain.txt_phone.value; var d3 = document.datain.txt_email.value; var para = "f_name="+d1+"&f_phone="+d2+"&f_email="+d3;     http.open('POST', 'post_data.php');     http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');     http.send(para);     http.onreadystatechange = somethingelse; } [/code] The data was successfully transfered to my PHP file which properly executed and the result as display. What I'm trying now is how to use two request objects and get them to work one after the other. For example, once data has been successfully posted, to select all data in the database table and display as an HTML table
  4. Thanks, I'm making progress now. Will keep u updated with progress and questions.  :)
  5. I've been keenly followingg this discussion and I've been practising the steps but it didn't work for me. I'm a newbie at this. What I wish to do is simply to display an "echo" command from a php file into a div in my main html page. If I can get this to work, I will be very happy and will be able to progress to database issues. My goal is to design a web-based database application using mySQL, PHO and AJAX/javascript. Please, I really need help and any useful tutorials I can get.
×
×
  • 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.