Jump to content

Archived

This topic is now archived and is closed to further replies.

goocharlton

WANTED PHP SCRIPT WANTED

Recommended Posts

Hi all,
I am looking for a PHP script that will process a form with numerous text boxes and a file upload part, then it sends it to my email.
For example i want it to submit this form.
[a href=\"http://home.exetel.com.au/anne_durie/MTBtrail.net/AddTrack.htm\" target=\"_blank\"]http://home.exetel.com.au/anne_durie/MTBtr...et/AddTrack.htm[/a]

If any one can help it would be greatly appreciated.

Cheers
Charlton

Share this post


Link to post
Share on other sites
you need to have two pages..
one.. what ever name
[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Add Track</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#640000">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="700" height="395"><img src="RAW%20Data/background_1.jpg" width="700" height="404" border="0" usemap="#Map"></td>
  </tr>
  <tr>
    <td width="700" background="RAW Data/background_2.jpg">
<hr width="60%">
      <div align="center">
        <p><font size="7"><strong>Add Track </strong></font></p>
        <form action="send.php" method="post" enctype="multipart/form-data" name="SampleForm" target="_blank">
          <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT,AUTH_TYPE,REMOTE_USER">
          <!-- STEP 2: Put your email address in the 'recipients' value.
                 Note that you also have to allow this email address in the
                 $TARGET_EMAIL setting within formmail.php!
    -->
          <input type="hidden" name="recipients" value="mtba@durie.com.au" />
          <!-- STEP 3: Specify required fields in the 'required' value -->
          <input type="hidden" name="required" value="email:Your email address,realname:Your name" />
          <!-- STEP 4: Put your subject line in the 'subject' value. -->
          <input type="hidden" name="subject" value="SITE- Add Track" />
          <table width="662" height="0" border="0" cellpadding="0" cellspacing="5">
            <tr>
              <td width="227" valign="top"> <p align="right">Please enter your
                  name:</p></td>
              <td width="213"><input name="realname" type="text" id="realname" />
              </td>
              <td width="213" rowspan="2"><a href="Privacy Statement.htm" target="_blank">View
                privacy statement</a></td>
            </tr>
            <tr>
              <td valign="top"> <p align="right">Please enter your email address:</p></td>
              <td><input name="email" type="text" id="email" /> </td>
            </tr>
            <tr>
              <td valign="top"> <p align="right">Which state is the track located</p></td>
              <td colspan="2"><select name="State" id="State">
                  <option>New South Wales</option>
                  <option>Australian Capital Territory</option>
                  <option>Western Australia</option>
                  <option>Victoria</option>
                  <option>Queensland</option>
                  <option>Tasmania</option>
                  <option>Northern Territory</option>
                  <option>South Australia</option>
                  <option>New Zealand</option>
                  <option>Fiji</option>
                  <option>New Caledonia</option>
                  <option>Papua New Guinea</option>
                  <option>Solomon islands</option>
                  <option>Vanuatu</option>
                </select> </td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Town where track is:</div></td>
              <td colspan="2"><input name="Town" type="text" id="Town"></td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track Name:</div></td>
              <td colspan="2"><input name="Trackname" type="text" id="Trackname"></td>
            </tr>
            <tr>
              <td valign="top"> <p align="right">Specific track location</p></td>
              <td colspan="2"><textarea name="location" cols="50" rows="10" id="location"></textarea>
              </td>
            </tr>
            <tr>
              <td valign="top"><p align="right">Track Map</p></td>
              <td colspan="2" valign="top"><input name="map" type="file" id="map">
              </td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track description</div></td>
              <td colspan="2"><textarea name="description" cols="50" rows="10" id="description"></textarea></td>
            </tr>
            <tr>
              <td width="227" valign="top"><div align="right">Track map </div></td>
              <td colspan="2"><input name="*(Track map)*" type="file" id="*(Track map)*"></td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track picture</div></td>
              <td colspan="2"><input name="*(Track picture)*" type="file" id="*(Track picture)*"></td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track picture</div></td>
              <td colspan="2"><input name="*(Track picture)*" type="file" id="*(Track picture)*"></td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track picture</div></td>
              <td colspan="2"><input name="*(Track picture)*" type="file" id="*(Track picture)*"></td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track picture</div></td>
              <td colspan="2"><input name="*(Track picture)*" type="file" id="*(Track picture)*"></td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track type:</div></td>
              <td height="0" colspan="2"> <input name="type" type="text" id="type" size="20">
                eg.Freeride, Downhill, XC, Dirt Jumps, 4X </td>
            </tr>
            <tr>
              <td valign="top"><div align="right">Track rating</div></td>
              <td colspan="2"><select name="rating" id="rating">
                  <option>10</option>
                  <option>9</option>
                  <option>8</option>
                  <option>7</option>
                  <option>6</option>
                  <option>5</option>
                  <option>4</option>
                  <option>3</option>
                  <option>2</option>
                  <option>1</option>
                </select>
                (10= highest)</td>
            </tr>
            <tr>
              <td valign="top"> <p align="right">Any other information</p></td>
              <td colspan="2"><textarea name="other" cols="50" rows="10" id="other"></textarea>
              </td>
            </tr>
            <tr>
              <td height="21" valign="top"> <div align="right">
                  <input type="reset" name="Reset" value="Clear">
                  <input name="Submit Button" type="submit" id="Submit Button" value="Submit" />
              </div></td>
              <td colspan="2"></td>
            </tr>
          </table>
        </form>
        
      </div>
      <hr width="60%"></td>
  </tr>
  <tr>
    <td height="400" align="right" valign="top" background="RAW Data/background_3.jpg">
      <p></p>
      <p></p>
      <p></p>
      <p></p>
      <p></p>
      <blockquote>
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
          <input type="hidden" name="cmd" value="_s-xclick">
          <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-butcc-donate.jpg" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
          <img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.jpg" width="1" height="1">
          <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHHgYJKoZIhvcNAQcEoIIHDzCCBwsCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMB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kJ609gYOsRitMsYZIdSsrgBmaJSWh76XBh235feHYNzWAesVctCQ5B/2kTygwQBZr3VV60MzLCbiqSuk87eiTb6f5tf6Q/Vrw+Ap5mpNkMD0X9/L+Ezg2SUldw+tuzTSj1mWGebg=-----END PKCS7-----
">
        </form>
    </blockquote></td>
  </tr>
  <tr>
    <td width="700"><img src="RAW%20Data/background_4.jpg" width="700" height="50" border="0" usemap="#Map2"></td>
  </tr>
</table>
<map name="Map">
  <area shape="poly" coords="492,307,508,303,517,298,513,288,490,281,477,270,450,263,422,262,399,262,380,265,361,274,343,285,338,297,341,308,358,321,376,325,388,332,408,334,392,333,422,333,444,332,468,327,484,317" href="Home.htm">
  <area shape="poly" coords="511,235,528,233,552,233,571,233,589,239,603,246,609,255,610,270,602,279,568,287,551,283,526,275,512,272,496,264,492,256" href="Tracks.htm">
  <area shape="poly" coords="175,276,192,275,216,279,231,285,245,288,255,288,241,298,230,308,214,318,192,318,172,317,161,308,153,298,155,282,169,278" href="News.htm">
</map>
<map name="Map2">
  <area shape="rect" coords="230,25,284,45" href="Frequent%20Asked%20Questions.htm">
  <area shape="rect" coords="447,25,501,45" href="index.htm">
  <area shape="rect" coords="370,25,439,45" href="Donation.htm">
  <area shape="rect" coords="450,50,498,71" href="index.htm">
  <area shape="rect" coords="369,50,437,71" href="Donation.htm">
  <area shape="rect" coords="290,50,358,71" href="Contacts.htm">
  <area shape="rect" coords="234,50,282,71" href="Frequent%20asked%20questions.htm">
  <area shape="rect" coords="289,25,358,45" href="Contacts.htm">
</map>
</body>
</html>
[/code]
two named send.php or waht ever the action of the form is..
[code]<?php
  $realname=$_POST['realname'];
  $email=$_POST['email'];
  $state=$_POST['State'];
   $town=$_POST['town'];
  $trackname=$_POST['Trackname'];
    $location=$_POST['location'];
      $map=$_POST['map'];
        $description=$_POST['description'];
          $pic1=$_POST['pic1'];
            $pic2=$_POST['pic2'];
      $pic3=$_POST['pic3'];  
       $pic4=$_POST['pic4'];  
         $type=$_POST['type'];  
           $rating=$_POST['rating'];
           $other=$_POST['other'];


  $toaddress = 'YOURADRESS    ';
  $subject = 'YOUR SUBJECT';
  $mailcontent = 'Name: '.$realname."\n"
                 .'Email: '.$email."\n"
                     .'state: '.$state."\n"
                         .'town: '.$town."\n"
                             .'trackname: '.$trackname."\n"
                                 .'location: '.$location."\n"
                                     .'map: '.$map."\n"
                                         .'description: '.$description."\n"
                                             .'pic1: '.$pic1."\n"
                                                  .'pic2: '.$pic2."\n"
                                                  .'pic3: '.$pic3."\n"
                                                      .'pic4: '.$pic4."\n"
                                                          .'type: '.$type."\n"  
                                                            .'rating: '.$rating."\n"
                                                        
                ."other comments : \n".$other."\n";

  $fromaddress = 'From: YOU.com';
  mail($toaddress, $subject, $mailcontent, $fromaddress);
?>[/code]

well thats a quick one.. hope it works..

PS if you want me to do one with the boex and stuff you want.. let me know.. I could do it for you..

Share this post


Link to post
Share on other sites
Thanks but that only add the data bot the pics.

Does someone know of a way of submitting the form to my email address but then the pics are sent to my email address as an attachment.

Share this post


Link to post
Share on other sites
here's a little throwed together program that should get you started. I got it from someone -- maybe even on this forum, converted it for my use, and it's been working great. It only sends one attachment, though. So, if you're accepting multiple uploads, you can turn the $encoded and $thisfile into an array and enclose in a do { } while(next($_FILES)); loop.

I would have done it, but I'm not entirely sure how to handle the attachment of multiple files -- you'll have to experiment.

[code]<?php
ini_set("memory_limit","128M");
$thisfile = $_FILES[key($files)]['name'];
$encoded = chunk_split(base64_encode(file_get_contents($_FILES[key($files)]['tmp_name'])));
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= "Content-Type: multipart/mixed;
   boundary=\"----MessageBoundary\"\n";

$message = '

This is a multi-part message in MIME format.

------MessageBoundary
Content-Type: text/plain;
       charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hello

File attached.

Regards

------MessageBoundary
Content-Type: application/octet-stream;  name="';

$message .= "$thisfile";
$message .= '"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="';
$message .= "$thisfile";
$message .= '"

';
$message .= "$encoded";
$message .= '

------MessageBoundary--

';

// now send the email
mail("user@example.com","online contact form", $message, $headers);

?>[/code]

Share this post


Link to post
Share on other sites

It kind of depends on the file you're sending. If it's a jpeg image, you can change the "Content-Type: application/octet-stream;" to the more appropriate "Content-Type: image/jpeg;"

Problem is, you really won't know what it is unless you check. end(explode(".",$_FILES[key($_FILES)]['name'])); should give you the file extension: jpg, png, gif, etc.

Share this post


Link to post
Share on other sites

×

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.