Jump to content

kaspm

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Everything posted by kaspm

  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
  16. I appreciate the help guys but even that doesnt correct the problem
  17. its not even sending the mail
  18. Ok here is the code I got so far there are a lot more fields I want to send but I was trying it out. Now when i go to the last page of the form it doesnt show its just a plain white page. What could be the problem? Thanks <?php $to = 'myemail@whatever.com'; $subject = 'Test; $name = $_post['StartMonth','StartYear']; $message = "$name"; $headers = 'From: website@whatever.com' . "\r\n" . mail($to, $subject, $message, $headers); ?>
  19. Ok. Im getting my "values" from my form, The values are from the "name" of the form field Example <input type="text" name="Value1">
  20. I have a multipage form, that I want to be sent to my email once it has been submitted. Im new to php so any help you give me I appreciate. I have a 4 page form and have all the values "hidden" on the last page. In order to email the form, should I put this code on the last page. [code]<?php $to      = 'myemail@whatever.com'; $subject = 'the subject'; $message = 'Value1''Value2''Value3''AndSoOn'; $headers = 'From: website@whatever.com' . "\r\n" . mail($to, $subject, $message, $headers); ?> [/code]
  21. Hi, I have a multipage form I want to send to an email address. Do I have to use: mail($whatever && $next for all the fields or would there be an eaiser way to do it. Thanks
  22. Thanks Crayon that really help a lot.
  23. I'm pretty new to php could you post a simple code on how to do that, or a tutorial. Thanks
  24. Hi I have a members only area for my site, and I need to find out how to keep people from accessing pages when they are not logged in. If they try to access that page it needs to send them to the log in page. Can someone help. Thanks
  25. ok ill look at that 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.