Jump to content

kaspm

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kaspm's Achievements

Member

Member (2/5)

0

Reputation

  1. How could I have it email first like you were talking about
  2. I found the problem thanks for the help though
  3. Im getting an error. Receiving Directory Insuffiecent Permission. Can anyone help me please.
  4. That part of the code is on my page with the form on it. This is the code for my page with the form. [code]<?php $to = 'sold@photocardsandcalendars.com'; $subject = 'Calendar Sold'; $name = $_POST['BillingName'] . "\r\n" . $_POST['BillingCompany'] . "\r\n" . $_POST['BillingAddr1'] . "\r\n" . $_POST['BillingAddr2'] . "\r\n" . $_POST['BillingCity'] . "\r\n" . $_POST['BillingState'] . "\r\n" . $_POST['BillingZip'] . "\r\n" . $_POST['BillingPhone1'] . "\r\n" . $_POST['BillingPhone2'] . "\r\n" . $_POST['BillingEmail']; $message = $name; $headers = 'From: sales@photocardsandcalendars.com' . "\r\n"; mail($to, $subject, $message, $headers); ?> <?php // filename: upload.form.php // first let's set some variables // make a note of the current working directory relative to root. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // make a note of the location of the upload handler $uploadHandler = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'multiple.upload.processor.php'; // set a max file size for the html upload form $max_file_size = 10000000; // size in bytes // now echo the html page ?> <html> <head></head> <body> <form name="BillingForm" method="POST" enctype="multipart/form-data" action="<?php echo $uploadHandler ?>"> &nbsp;<table cellspacing="0" cellpadding="4" height="470" border="1" bordercolor="#000000" style="border-collapse: collapse" width="665">     <tr>       <td width="105" height="32"></td>       <td width="124" height="32"></td>       <td width="374" height="32">&nbsp;</td>     </tr>     <tr>       <td rowspan="9" width="105" height="289"></td>       <td width="124" height="22">Name</td>       <td width="374" height="22"><input type="text" name="Field1" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="36">Company Name</td>       <td width="374" height="36"><input type="text" name="Field2" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="22">Address1</td>       <td width="374" height="22"><input type="text" name="Field3" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="22">Address2</td>       <td width="374" height="22"><input type="text" name="Field4" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="44">City/State/Zip</td>       <td width="374" height="44"><input type="text" name="Field5" size="35"       value=""> <select name="Field6" size="1"> <option>AL<option>AK<option>AS<option>AZ<option>AR<option>CA<option>CO<option>CT<option>DE<option>DC<option>FM<option>FL<option>GA<option>GU<option>HI<option>ID<option>IL<option>IN<option>IA<option>KS<option>KY<option>LA<option>ME<option>MH<option>MD<option>MA<option>MI<option>MN<option>MS<option>MO<option>MT<option>NE<option>NV<option>NH<option>NJ<option>NM<option>NY<option>NC<option>ND<option>MP<option>OH<option>OK<option>OR<option>PW<option>PA<option>PR<option>RI<option>SC<option>SD<option>TN<option>TX<option>UT<option>VT<option>VI<option>VA<option>WA<option>WV<option>WI<option>WY      </select> <input type="text" name="Field7" size="10"       value=""></td>     </tr>     <tr>       <td width="124" height="36">Home Phone</td>       <td width="374" height="36"><input type="text" name="Field8" size="15"       value=""></td>     </tr>     <tr>       <td width="124" height="36">Office Phone</td>       <td width="374" height="36"><input type="text" name="Field9" size="15"       value=""></td>     </tr>     <tr>       <td width="124" height="23">E-Mail</td>       <td width="374" height="23"><input type="text" name="Field10" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="23">File Upload</td><td width="425"><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>"><input type="file" id="file1" name="file[]" size="50"></td>     </tr>     <tr>       <td rowspan="3" width="105" valign="top" height="45">&nbsp;</td>     </tr>     <tr>       <td width="124" height="1"></td>       <td width="374" height="1"></td>       <td height="1" width="61">       <input type="submit" value="Submit" name="submit" onClick="validateForm();"></td>     </tr>   </table> </form> </body> </html>[/code]
  5. This is the upload handler [code]<?php // filename: upload.processor.php // first let's set some variables // make a note of the current working directory, relative to root. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // make a note of the directory that will recieve the uploaded files $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . '/uploaded_files'; // make a note of the location of the upload form in case we need it $uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'multiple.upload.form.php'; // make a note of the location of the success page $uploadSuccess = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'multiple.upload.success.php'; // name of the fieldname used for the file in the HTML form $fieldname = 'file'; //echo'<pre>';print_r($_FILES);exit; // Now let's deal with the uploaded files // possible PHP upload errors $errors = array(1 => 'php.ini max file size exceeded',                 2 => 'html form max file size exceeded',                 3 => 'file upload was only partial',                 4 => 'no file was attached'); // check the upload form was actually submitted else print form isset($_POST['submit'])     or error('the upload form is neaded', $uploadForm);      // check if any files were uploaded and if // so store the active $_FILES array keys $active_keys = array(); foreach($_FILES[$fieldname]['name'] as $key => $filename) {     if(!empty($filename))     {         $active_keys[] = $key;     } } // check at least one file was uploaded count($active_keys)     or error('No files were uploaded', $uploadForm);          // check for standard uploading errors foreach($active_keys as $key) {     ($_FILES[$fieldname]['error'][$key] == 0)         or error($_FILES[$fieldname]['tmp_name'][$key].': '.$errors[$_FILES[$fieldname]['error'][$key]], $uploadForm); }      // check that the file we are working on really was an HTTP upload foreach($active_keys as $key) {     @is_uploaded_file($_FILES[$fieldname]['tmp_name'][$key])         or error($_FILES[$fieldname]['tmp_name'][$key].' not an HTTP upload', $uploadForm); }      // validation... since this is an image upload script we // should run a check to make sure the upload is an image foreach($active_keys as $key) {     @getimagesize($_FILES[$fieldname]['tmp_name'][$key])         or error($_FILES[$fieldname]['tmp_name'][$key].' not an image', $uploadForm); }      // make a unique filename for the uploaded file and check it is // not taken... if it is keep trying until we find a vacant one foreach($active_keys as $key) {     $now = time();     while(file_exists($uploadFilename[$key] = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name'][$key]))     {         $now++;     } } // now let's move the file to its final and allocate it with the new filename foreach($active_keys as $key) {     @move_uploaded_file($_FILES[$fieldname]['tmp_name'][$key], $uploadFilename[$key])         or error('receiving directory insuffiecient permission', $uploadForm); }      // If you got this far, everything has worked and the file has been successfully saved. // We are now going to redirect the client to the success page. header('Location: ' . $uploadSuccess); // make an error handler which will be used if the upload fails function error($error, $location, $seconds = 5) {     header("Refresh: $seconds; URL=\"$location\"");     echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'."\n".     '"http://www.w3.org/TR/html4/strict.dtd">'."\n\n".     '<html lang="en">'."\n".     '    <head>'."\n".     '        <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n".     '        <link rel="stylesheet" type="text/css" href="stylesheet.css">'."\n\n".     '    <title>Upload error</title>'."\n\n".     '    </head>'."\n\n".     '    <body>'."\n\n".     '    <div id="Upload">'."\n\n".     '        <h1>Upload failure</h1>'."\n\n".     '        <p>An error has occured: '."\n\n".     '        <span class="red">' . $error . '...</span>'."\n\n".     '         The upload form is reloading</p>'."\n\n".     '     </div>'."\n\n".     '</html>';     exit; } // end error handler ?>[/code]
  6. Is there a way to do that with out making it a seperate page
  7. [code]<form name="BillingForm" method="POST" enctype="multipart/form-data" action="<?php echo $uploadHandler ?>"> &nbsp;<table cellspacing="0" cellpadding="4" height="470" border="1" bordercolor="#000000" style="border-collapse: collapse" width="665">     <tr>       <td width="105" height="32"></td>       <td width="124" height="32"></td>       <td width="374" height="32">&nbsp;</td>     </tr>     <tr>       <td rowspan="9" width="105" height="289"></td>       <td width="124" height="22">Name</td>       <td width="374" height="22"><input type="text" name="Field1" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="36">Company Name</td>       <td width="374" height="36"><input type="text" name="Field2" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="22">Address1</td>       <td width="374" height="22"><input type="text" name="Field3" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="22">Address2</td>       <td width="374" height="22"><input type="text" name="Field4" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="44">City/State/Zip</td>       <td width="374" height="44"><input type="text" name="Field5" size="35"       value=""> <select name="Field6" size="1"> <option>AL<option>AK<option>AS<option>AZ<option>AR<option>CA<option>CO<option>CT<option>DE<option>DC<option>FM<option>FL<option>GA<option>GU<option>HI<option>ID<option>IL<option>IN<option>IA<option>KS<option>KY<option>LA<option>ME<option>MH<option>MD<option>MA<option>MI<option>MN<option>MS<option>MO<option>MT<option>NE<option>NV<option>NH<option>NJ<option>NM<option>NY<option>NC<option>ND<option>MP<option>OH<option>OK<option>OR<option>PW<option>PA<option>PR<option>RI<option>SC<option>SD<option>TN<option>TX<option>UT<option>VT<option>VI<option>VA<option>WA<option>WV<option>WI<option>WY      </select> <input type="text" name="Field7" size="10"       value=""></td>     </tr>     <tr>       <td width="124" height="36">Home Phone</td>       <td width="374" height="36"><input type="text" name="Field8" size="15"       value=""></td>     </tr>     <tr>       <td width="124" height="36">Office Phone</td>       <td width="374" height="36"><input type="text" name="Field9" size="15"       value=""></td>     </tr>     <tr>       <td width="124" height="23">E-Mail</td>       <td width="374" height="23"><input type="text" name="Field10" size="50"       value=""></td>     </tr>     <tr>       <td width="124" height="23">File Upload</td><td width="425"><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size ?>"><input type="file" id="file1" name="file[]" size="50"></td>     </tr>     <tr>       <td rowspan="3" width="105" valign="top" height="45">&nbsp;</td>     </tr>     <tr>       <td width="124" height="1"></td>       <td width="374" height="1"></td>       <td height="1" width="61">       <input type="submit" value="Submit" name="submit" onClick="validateForm();"></td>     </tr>   </table> </form>[/code]
  8. would it be a problem if i have a file upload on the same page
  9. There is data to send. I have this same code on multipage form and it works fine
  10. Hi I have a form I would like to have emailed to me. Here is the code I have on the page of the form. It sends the email, but it is just blank. Can you please help? [code]<?php $to = 'myemail@email.com'; $subject = 'Subject'; $name = $_POST['Field1'] . "\r\n" . $_POST['Field2'] . "\r\n" . $_POST['Field3'] . "\r\n" . $_POST['Field4'] . "\r\n" . $_POST['Field5'] . "\r\n" . $_POST['Field6'] . "\r\n" . $_POST['Field7'] . "\r\n" . $_POST['Field8'] . "\r\n" . $_POST['Field10'] . "\r\n" . $_POST['Field11']; $message = $name; $headers = 'From: email@email.com' . "\r\n"; mail($to, $subject, $message, $headers); ?>[/code]
  11. Is there a way to have a certain link show depending on what someone filled out in a form? Say if someone picked 1 it would show a link, or if someone picked 3 it would show a different link? Can anyone help
  12. kaspm

    PHP email(

    So it should look like this: $_POST['value'] \n . $_POST['value2'] \n . $_POST['value3'] and so on
  13. I have a multipage form and I have it sent to my email but its not formatted. Is there a way I can have each value from the form on one line. Right now its all bunched together. Thanks
  14. Hi, I have a multipage form that has a page for people to upload images. I want to have the images sent as attachments with the rest of the form. Does anyone know where I could find a tutorial on how to do this. Thanks
  15. I would like to thank everyone who helped me with this. I now have it working. Thanks
×
×
  • 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.