Jump to content

croix

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Posts posted by croix

  1. UPDATE

     

    The code is slightly different now, and now the problem i am having is a different one. Now, the page displays, and when I submit it, the information is written to the database properly. I also receive an email, but there is no text in the email, and there is a blank 0Kb mime-type file attached. Here is a screen shot of the email.

     

    app_email.jpg

     

    and here's the code:

     

    <?
    
    ////   functions  ///////////////////////////////////////
    
    function sendMail() {
      if (!isset ($_POST['agreement'])) { //Oops, you did not agree to our terms    
      die ("<p>Oops!  You did not agree to our terms! Click on the back arrow to go back</p>");
      }
      else {
        
        $from_name = stripslashes($_POST['from_name']);
        $from_email = stripslashes($_POST['from_email']);
        $to_name = stripslashes($_POST['to_name']);
        $to_email = stripslashes($_POST['to_email']);
        $firstname = stripslashes($_POST['firstname']);
        $lastname = stripslashes($_POST['lastname']);
        $phone = stripslashes($_POST['phone']);
        $fax = stripslashes($_POST['fax']);
        $address = stripslashes($_POST['address']);
        $address2 = stripslashes($_POST['address2']);
        $state = stripslashes($_POST['state']);
        $city = stripslashes($_POST['city']);
        $zip = stripslashes($_POST['zip']);
        $email = stripslashes($_POST['email']);
        $available = stripslashes($_POST['available']);
        $livein = stripslashes($_POST['livein']);
        $overnights = stripslashes($_POST['overnights']);
        $travel = stripslashes($_POST['travel']);
        $fulltime = stripslashes($_POST['fulltime']);
        $parttime = stripslashes($_POST['parttime']);
        $comment = stripslashes($_POST['comment']);
        $agreement = stripslashes($_POST['agreement']);
        $resume = $_FILES['resume']['tmp_name'];
        $resume_name = $_FILES['resume']['name'];
            if (is_uploaded_file($resume))    { //Do we have a file uploaded?
                $fp = fopen($resume, "rb"); //Open it
                $data = fread($fp, filesize($resume)); //Read it
                $data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can be emailed
                    fclose($fp);
                }
    
    //Let's start our headers
        /* ini_set(SMTP, "mail.thenannygroup.com");
        ini_set(smtp_port, 25);
        ini_set(sendmail_from, "web@thenannygroup.com"); */
        $headers = "From: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "Reply-To: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; 
        $headers .= "X-Sender: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "X-Mailer: PHP4\n";
        $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
        $headers .= "Return-Path: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "This is a multi-part message in MIME format.\n";
        $headers .= "------=MIME_BOUNDRY_main_message \n"; 
        $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
        
        $message = "------=MIME_BOUNDRY_message_parts\n";
        $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; 
        $message .= "Content-Transfer-Encoding: quoted-printable\n"; 
        $message .= "\n"; 
        /* Add our message, in this case it's plain text.  You could also add HTML by changing the Content-Type to text/html */
        $message .= "TheNannyGroup.com - You have a new nanny applicant!
        
        
            Personal Information
            
            First Name = {$firstname} 
            Last Name = {$lastname}
            Phone = {$phone}
            Fax = {$fax}
            Address = {$address}
            Unit = {$address2}
            State = {$state}
            City = {$city}
            Zip = {$zip}
            Email = {$email}
            
        
            Employment Information
            
            Date Available = {$available}
            Live In = {$livein}
            Overnights = {$overnights}
            Travel = {$travel}
            Full Time = {$fulltime}
            Part Time = {$parttime}
            
            
            Other Information
            
            Comment = {$comment}\n";
        
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_message_parts--\n"; 
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message\n"; 
        $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $resume_name . "\"\n";
        $message .= "Content-Transfer-Encoding: base64\n";
        $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $resume_name . "\"\n\n";
        $message .= $data; //The base64 encoded message
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message--\n";
        
        //Send the message
        
    mail("to_name<$to_email>", $subject, $message, $headers);
        echo "Mail Sent. Thank you for your interest.";
    
        //--> adding entry to the DB on successful Mail Send
        Enter_New_Entry($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement);
        }
    }
    
    function Enter_New_Entry 
    ($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement) {
    
    $cnx = mysql_connect("localhost","*********","*********");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
    $db_selected = mysql_select_db('**********', $cnx);
    if (!$db_selected) {
        die ('Can\'t use Records Database : ' . mysql_error());
    }
    
        $SQL_Exec_String = "Insert Into ********* (firstname, lastname, phone, fax, address, address2, state, city, zip, email, available, livein, overnights, travel, fulltime, parttime, comment, agreement)
                Values ('$firstname', '$lastname', '$phone', '$fax', '$address', '$address2', '$state', '$city', '$zip', '$email', '$available', '$livein', '$overnights', '$travel', '$fulltime', '$parttime', '$comment', '$agreement')";
    
        $cur = mysql_query($SQL_Exec_String);
        if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    
    mysql_close($cnx);  
    header("location: http://www.thenannygroup.com/verify.php"); 
    
    }
    
    ////   code  ///////////////////////////////////////
    
    if (!empty($_POST)) { sendMail(); }
    
    ?>
    

     

  2. I dont know what it is you are looking for. Everything I have is all on one page, which is the code posted above. I will include the entire page, html and all.

     

     

    <?php ob_start(); ?>
    <?
    
    ////   functions  ///////////////////////////////////////
    
    function sendMail() {
      if (!isset ($_POST['agreement'])) { //Oops, you did not agree to our terms    
      die ("<p>Oops!  You did not agree to our terms! Click on the back arrow to go back</p>");
      }
      else {
        
        $from_name = stripslashes($_POST['from_name']);
        $from_email = stripslashes($_POST['from_email']);
        $to_name = stripslashes($_POST['to_name']);
        $to_email = stripslashes($_POST['to_email']);
        $firstname = stripslashes($_POST['firstname']);
        $lastname = stripslashes($_POST['lastname']);
        $phone = stripslashes($_POST['phone']);
        $fax = stripslashes($_POST['fax']);
        $address = stripslashes($_POST['address']);
        $address2 = stripslashes($_POST['address2']);
        $state = stripslashes($_POST['state']);
        $city = stripslashes($_POST['city']);
        $zip = stripslashes($_POST['zip']);
        $email = stripslashes($_POST['email']);
        $available = stripslashes($_POST['available']);
        $livein = stripslashes($_POST['livein']);
        $overnights = stripslashes($_POST['overnights']);
        $travel = stripslashes($_POST['travel']);
        $fulltime = stripslashes($_POST['fulltime']);
        $parttime = stripslashes($_POST['parttime']);
        $comment = stripslashes($_POST['comment']);
        $agreement = stripslashes($_POST['agreement']);
        $resume = $_FILES['resume']['tmp_name'];
        $resume_name = $_FILES['resume']['name'];
            if (is_uploaded_file($resume))    { //Do we have a file uploaded?
                $fp = fopen($resume, "rb"); //Open it
                $data = fread($fp, filesize($resume)); //Read it
                $data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can be emailed
                    fclose($fp);
                }
    
    //Let's start our headers
        ini_set(SMTP, "mail.thenannygroup.com");
        ini_set(smtp_port, 25);
        ini_set(sendmail_from, "web@thenannygroup.com");
        $headers = "From: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "Reply-To: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; 
        $headers .= "X-Sender: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "X-Mailer: PHP4\n";
        $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
        $headers .= "Return-Path: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "This is a multi-part message in MIME format.\n";
        $headers .= "------=MIME_BOUNDRY_main_message \n"; 
        $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
        
        $message = "------=MIME_BOUNDRY_message_parts\n";
        $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; 
        $message .= "Content-Transfer-Encoding: quoted-printable\n"; 
        $message .= "\n"; 
        /* Add our message, in this case it's plain text.  You could also add HTML by changing the Content-Type to text/html */
        $message .= "TheNannyGroup.com - You have a new nanny applicant!
        
        
            Personal Information
            
            First Name = {$firstname} 
            Last Name = {$lastname}
            Phone = {$phone}
            Fax = {$fax}
            Address = {$address}
            Unit = {$address2}
            State = {$state}
            City = {$city}
            Zip = {$zip}
            Email = {$email}
            
        
            Employment Information
            
            Date Available = {$available}
            Live In = {$livein}
            Overnights = {$overnights}
            Travel = {$travel}
            Full Time = {$fulltime}
            Part Time = {$parttime}
            
            
            Other Information
            
            Comment = {$comment}\n";
        
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_message_parts--\n"; 
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message\n"; 
        $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $resume_name . "\"\n";
        $message .= "Content-Transfer-Encoding: base64\n";
        $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $resume_name . "\"\n\n";
        $message .= $data; //The base64 encoded message
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message--\n";
        
        //Send the message
        
    mail("to_name<$to_email>", $subject, $message, $headers);
        echo "Mail Sent. Thank you for your interest.";
    
        //--> adding entry to the DB on successful Mail Send
        Enter_New_Entry($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement);
        }
    }
    
    function Enter_New_Entry 
    ($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement) {
    
    $cnx = mysql_connect("localhost","*********","*********");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
    $db_selected = mysql_select_db('*********', $cnx);
    if (!$db_selected) {
        die ('Can\'t use Records Database : ' . mysql_error());
    }
    
        $SQL_Exec_String = "Insert Into ********* (firstname, lastname, phone, fax, address, address2, state, city, zip, email, available, livein, overnights, travel, fulltime, parttime, comment, agreement)
                Values ('$firstname', '$lastname', '$phone', '$fax', '$address', '$address2', '$state', '$city', '$zip', '$email', '$available', '$livein', '$overnights', '$travel', '$fulltime', '$parttime', '$comment', '$agreement')";
    
        $cur = mysql_query($SQL_Exec_String);
        if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    
    mysql_close($cnx);  
    header("location: http://www.thenannygroup.com/verify.php"); 
    
    }
    
    ////   code  ///////////////////////////////////////
    
    sendMail();
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <title>Become a Nanny - Apply to be listed on The Nanny Group</title>
    <meta name="description" content="Please fill out this form to be considered for a listing on TheNannyGroup.com"/>
    <meta name="keywords" content="become, apply, nanny group, nanny, nurse, night nurse, babysitter, childcare, home, referral, background check, location, search, find, dallas, texas, tx"/>
    <meta NAME="REVISIT-AFTER" CONTENT="14 days">
    <meta name="author" content="The Nanny Group - 6046 Penrose Ave, Dallas, TX 75206">
    <meta NAME="ROBOTS" CONTENT="ALL">
    <meta NAME="DISTRIBUTION" CONTENT="GLOBAL">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta name="copyright" content="Copyright (c)2007 THE NANNY GROUP. All rights reserved." />
    <link rel="stylesheet" type="text/css" href="tng_style.css" />
    <style type="text/css">
    <!--
    body {
    background-image: url(images/TileBG.jpg);
    background-repeat: repeat;
    }
    -->
    </style>
    <script type="text/JavaScript">
    <!--
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    </script>
    </head>
    
    <body onload="MM_preloadImages('images/tng_home_2.png','images/tng_services_2.png','images/tng_apply_2.png','images/tng_search_2.png','images/tng_contact_2.png','images/tng_testimonials_2.png','images/tng_background_2.png')">
    <div id="container">
    <div id="header"></div>
    <div id="content">
    
    
    <div id="main">
    <form action="http://www.thenannygroup.com/apply_inprogress3.php" method="post">
    <input name="from_name" type="hidden" id="from_name" value="The Nanny Group" />
    <input name="from_email" type="hidden" id="from_email" value="web@thenannygroup.com" />
    <input name="to_name" type="hidden" id="to_name" value="The Nanny Group" />
    <input name="to_email" type="hidden" id="to_email" value="applicants@thenannygroup.com" />
    <fieldset><legend>Contact Information</legend><br>
    <table>
    
    <tr>
    	<td><p><label for="firstname">First Name</label> <input name="firstname" type="text" id="firstname" />
    </p><br>
    	</td>
    	<td><p><label for="lastname">Last Name</label> <input name="lastname" type="text" id="lastname" />
    </p><br>
    	</td>
    </tr>
    
    <tr>
    	<td><p><label for="phone">Phone</label> <input name="phone" type="text" id="phone" />
    </p><br>
    	</td>
    	<td><p><label for="fax">Fax</label> <input name="fax" type="text" id="fax" value="optional"/>
    </p><br>
    	</td>
    </tr>
    
    <tr>
    	<td><p><label for="address">Address</label> <input name="address" type="text" id="address" />
    </p>
    <p><label for="address2">Unit</label> <input name="address2" type="text" id="address2" value="optional"/>
    </p><br>
    	</td>
    	<td><p><label for="state">State</label> <select name="state" id="state" />
    <option>My State</option>
    	  <option>Puerto Rico</option>
              <option>Alabama</option>
              <option>Alaska</option>
              <option>Arizona</option>
              <option>Arkansas</option>
              <option>California</option>
              <option>Colorado</option>
    	  <option>Conneticut</option>
              <option>Delaware</option>
              <option>Florida</option>
              <option>Georgia</option>
              <option>Hawaii</option>
    	  <option>Idaho</option>
              <option>Illinois</option>
              <option>Indiana</option>
    	  <option>Iowa</option>
              <option>Kansas</option>
              <option>Kentucky</option>
    	  <option>Louisiana</option>
              <option>Maine</option>
              <option>Maryland</option>
    	  <option>Massachusetts</option>
    	  <option>Michigan</option>
              <option>Minnesota</option>
              <option>Mississippi</option>
    	  <option>Missouri</option>
              <option>Montana</option>
              <option>Nebraska</option>
    	  <option>Nevada</option>
              <option>New Hampshire</option>
              <option>New Jersey</option>
    	  <option>New Mexico</option>
              <option>New York</option>
              <option>North Carolina</option>
              <option>North Dakota</option>
              <option>Ohio</option>
    	  <option>Oklahoma</option>
              <option>Oregon</option>
              <option>Pennsylvania</option>
      	  <option>Rhode Island</option>
    	  <option>South Carolina</option>
              <option>South Dakota</option>
              <option>Tennessee</option>
          <option>Texas</option>
      	  <option>Utah</option>
    	  <option>Vermont</option>
              <option>Virginia</option>
              <option>Washington</option>
    	  <option>Washington, DC</option>
    	  <option>West Virginia</option>
              <option>Wisconsin</option>
              <option>Wyoming</option>
    	  <option>Other</option>
    </select></p><br>
    	</td>
    </tr>
    
    <tr>
    	<td><p><label for="city">City</label><input name="city" type="text" id="city" />
    </p>
    	</td>
    	<td><p><label for="zip">Zip</label><input name="zip" type="text" id="zip" size="10" />
    </p>
    	</td>
    </tr>
    
    </table>	<br>
    <p><label for="email">Email</label><input name="email" type="text" id="email" />
    </p>
    
    </fieldset>
    
    <fieldset>
    <legend>Employment Information</legend><br>
    
    	<p><label for="company">Date Available</label> <input name="available" type="text" id="available" />
    </p><br>
    
    	<p><label for="resume">Resume</label><input name="resume" type="file" id="resume"  />
    </p><br>
    <table>
    <tr>
    	<td><p><label for="livein">Live In</label><input name="livein" type="checkbox" id="livein" value="yes" />
    	</td>
    	<td><p><label for="overnights">Overnights</label><input name="overnights" type="checkbox" id="overnights" value="yes" />
    	</td>
    	<td><p><label for="travel">Travel</label><input name="travel" type="checkbox" id="travel" value="yes" />
    	</td>
    </tr>
    <tr>
    	<td><p><label for="fulltime">Full Time</label><input name="fulltime" type="checkbox" id="fulltime" value="yes" />
    	</td>
    	<td><p><label for="parttime">Part Time</label><input name="parttime" type="checkbox" id="parttime" value="yes" />
    	</td>
    
    </tr>
    </table>	
    
    
    
    
    </fieldset>
    
    <fieldset><legend>Additional Information</legend><br>
    <p><label for="comment"><div align="center">Questions <br>or<br> Comments</div></label><textarea name="comment" cols="50" rows="4" id="comment">optional</textarea></p><br>
    <p><img src="images/spacer.gif" width="25" height="5" /><input name="agreement" type="checkbox" id="agreement" value="yes" /><img src="images/spacer.gif" width="5" height="5" />I agree to the <a href="terms.php" target="_blank">Terms of Employment</a></p>
    <br>
    <p class="submit"><input type="submit" value="Submit" /><p class="reset"><input type="reset" value="Reset" /></p>
    
    </form>
    </div>
    
    <div id="navcolumn">
    
    <a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','images/tng_home_2.png',1)"><img src="images/tng_home_1.png" alt="Home" name="Home" width="180" height="60" border="0" id="Home" /></a>
    <a href="services.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Services','','images/tng_services_2.png',1)"><img src="images/tng_services_1.png" alt="Our Services" name="Services" width="180" height="29" border="0" id="Services" /></a>
    <a href="apply.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Apply','','images/tng_apply_2.png',1)"><img src="images/tng_apply_1.png" alt="Apply to be a Nanny" name="Apply" width="180" height="30" border="0" id="Apply" /></a>
    <a href="search.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Search','','images/tng_search_2.png',1)"><img src="images/tng_search_1.png" alt="Search for a Nanny" name="Search" width="180" height="33" border="0" id="Search" /></a>
    <a href="contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Contact','','images/tng_contact_2.png',1)"><img src="images/tng_contact_1.png" alt="Contact Us" name="Contact" width="180" height="36" border="0" id="Contact" /></a>
    <a href="testimonials.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Testimonials','','images/tng_testimonials_2.png',1)"><img src="images/tng_testimonials_1.png" alt="Client Testimonials" name="Testimonials" width="180" height="33" border="0" id="Testimonials" /></a>
    <a href="background.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Background','','images/tng_background_2.png',1)"><img src="images/tng_background_1.png" alt="Background Check Service" name="Background" width="180" height="74" border="0" id="Background" /></a>
    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    </div>
    
    
    </div>
    
    <div id="footer"></div>
    </div>
    <div align="center">
        <h2><a href="index.php">Home</a> | <a href="services.php">Services</a> | <a href="apply.php">Apply</a> | <a href="search.php">Search</a> | <a href="contact.php">Contact Us</a> | <a href="testimonials.php">Testimonials</a> | <a href="background.php">Background Check</a> | <a href="sitemap.php">Site Map</a></h2>
    </div>
    </body>
    
    </html>
    <?php
        include_once 'replacePngTags.php';
        echo replacePngTags(ob_get_clean());
    ?>
    

  3. to_email is a hidden field in my form. but i changed it anyway, to check for my agreement. In the process, i accidentaly commented out my "die" line, and the page shows up when i do that. with that line commented out, the page appears, and when i fill it out and submit, the information is stored in my database, and i am redirected to my header page, but the email never comes.

     

    if the die line is left in, i just instantly get the error on screen "Oops!  You did not agree to our terms! Click on the back arrow to go back"

     

    Here is the updated code:

     

    <?
    
    ////   functions  ///////////////////////////////////////
    
    function sendMail() {
      if (!isset ($_POST['agreement'])) { //Oops, you did not agree to our terms    
      die ("<p>Oops!  You did not agree to our terms! Click on the back arrow to go back</p>");
      }
      else {
        
        $from_name = stripslashes($_POST['from_name']);
        $from_email = stripslashes($_POST['from_email']);
        $to_name = stripslashes($_POST['to_name']);
        $to_email = stripslashes($_POST['to_email']);
        $firstname = stripslashes($_POST['firstname']);
        $lastname = stripslashes($_POST['lastname']);
        $phone = stripslashes($_POST['phone']);
        $fax = stripslashes($_POST['fax']);
        $address = stripslashes($_POST['address']);
        $address2 = stripslashes($_POST['address2']);
        $state = stripslashes($_POST['state']);
        $city = stripslashes($_POST['city']);
        $zip = stripslashes($_POST['zip']);
        $email = stripslashes($_POST['email']);
        $available = stripslashes($_POST['available']);
        $livein = stripslashes($_POST['livein']);
        $overnights = stripslashes($_POST['overnights']);
        $travel = stripslashes($_POST['travel']);
        $fulltime = stripslashes($_POST['fulltime']);
        $parttime = stripslashes($_POST['parttime']);
        $comment = stripslashes($_POST['comment']);
        $agreement = stripslashes($_POST['agreement']);
        $resume = $_FILES['resume']['tmp_name'];
        $resume_name = $_FILES['resume']['name'];
            if (is_uploaded_file($resume))    { //Do we have a file uploaded?
                $fp = fopen($resume, "rb"); //Open it
                $data = fread($fp, filesize($resume)); //Read it
                $data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can be emailed
                    fclose($fp);
                }
    
    //Let's start our headers
        ini_set(SMTP, "mail.thenannygroup.com");
        ini_set(smtp_port, 25);
        ini_set(sendmail_from, "web@thenannygroup.com");
        $headers = "From: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "Reply-To: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; 
        $headers .= "X-Sender: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "X-Mailer: PHP4\n";
        $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
        $headers .= "Return-Path: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "This is a multi-part message in MIME format.\n";
        $headers .= "------=MIME_BOUNDRY_main_message \n"; 
        $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
        
        $message = "------=MIME_BOUNDRY_message_parts\n";
        $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; 
        $message .= "Content-Transfer-Encoding: quoted-printable\n"; 
        $message .= "\n"; 
        /* Add our message, in this case it's plain text.  You could also add HTML by changing the Content-Type to text/html */
        $message .= "TheNannyGroup.com - You have a new nanny applicant!
        
        
            Personal Information
            
            First Name = {$firstname} 
            Last Name = {$lastname}
            Phone = {$phone}
            Fax = {$fax}
            Address = {$address}
            Unit = {$address2}
            State = {$state}
            City = {$city}
            Zip = {$zip}
            Email = {$email}
            
        
            Employment Information
            
            Date Available = {$available}
            Live In = {$livein}
            Overnights = {$overnights}
            Travel = {$travel}
            Full Time = {$fulltime}
            Part Time = {$parttime}
            
            
            Other Information
            
            Comment = {$comment}\n";
        
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_message_parts--\n"; 
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message\n"; 
        $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $resume_name . "\"\n";
        $message .= "Content-Transfer-Encoding: base64\n";
        $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $resume_name . "\"\n\n";
        $message .= $data; //The base64 encoded message
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message--\n";
        
        //Send the message
        
    mail("to_name<$to_email>", $subject, $message, $headers);
        echo "Mail Sent. Thank you for your interest.";
    
        //--> adding entry to the DB on successful Mail Send
        Enter_New_Entry($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement);
        }
    }
    
    function Enter_New_Entry 
    ($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement) {
    
    $cnx = mysql_connect("localhost","********","********");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
    $db_selected = mysql_select_db('********', $cnx);
    if (!$db_selected) {
        die ('Can\'t use Records Database : ' . mysql_error());
    }
    
        $SQL_Exec_String = "Insert Into ******** (firstname, lastname, phone, fax, address, address2, state, city, zip, email, available, livein, overnights, travel, fulltime, parttime, comment, agreement)
                Values ('$firstname', '$lastname', '$phone', '$fax', '$address', '$address2', '$state', '$city', '$zip', '$email', '$available', '$livein', '$overnights', '$travel', '$fulltime', '$parttime', '$comment', '$agreement')";
    
        $cur = mysql_query($SQL_Exec_String);
        if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    
    mysql_close($cnx);  
    header("location: http://www.thenannygroup.com/verify.php"); 
    
    }
    
    ////   code  ///////////////////////////////////////
    
    sendMail();
    
    ?>
    

  4. quick google search returned this, not sure if you can use part of it:

     

    PHP and Perl example source code

     

    The following code is for demonstration purposes only. Please ensure that your web-server has set a correct local time and ask your local server's clock instead of sending time queries to distant servers via the internet.

     

    <?php

    $timestamp = time();

    $datum = date("Y-m-d (D) H:i:s",$timestamp);

    echo "Current date and local time on this server is $datum <br>\n";

    ?>

    How to do time server queries

     

    Open a socket connection to the time server on port 13 (daytime) or 37 (time), send an empty string (newline), read the result and close the connection. Then look at the result and display.

     

    The PHP-code is easy and should be self-explaining.

     

    <?php # PHP V4

     

    function query_time_server ($timeserver, $socket) {

    /* Query a time server

      © 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */

     

      $fp = fsockopen($timeserver,$socket,$err,$errstr,5);

            # parameters: server, socket, error code, error text, timeout

      if ($fp) {

        fputs($fp,"\n");

        $timevalue = fread($fp,49);

        fclose($fp); # close the connection

      }

      else {

        $timevalue = " ";

      }

     

      $ret = array();

      $ret[] = $timevalue;

      $ret[] = $err;    # error code

      $ret[] = $errstr;  # error text

      return($ret);

     

    } # function query_time_server

    ?>

     

    Query a time server on port 13 (DAYTIME protocol)

     

    <?php

    /* Query a time server

      © 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */

    $timeserver = "time-C.timefreq.bldrdoc.gov";

    $timercvd = query_time_server($timeserver,13);

    if (!$timercvd[1]) { # if no error from query_time_server

      $timevalue = $timercvd[0];

      echo "Time check from time server ",$timeserver," : [<font color=\"red\">",$timevalue,"</font>].<br>\n";

    } #if (!$timercvd)

    else {

      echo "Unfortunately, the time server $timeserver could not be reached at this time. ";

      echo "$timercvd[1] $timercvd[2].<br>\n";

    } # else

    ?>

     

    Query a time server on port 37 (TIME protocol) :

     

    <?php

    /* Query a time server

      © 1999-09-29, Ralf D. Kloth (QRQ.software) <ralf at qrq.de> */

    $timeserver = "ntp1.sf-bay.org";

    $timercvd = query_time_server($timeserver,37);

    if (!$timercvd[1]) { # if no error from query_time_server

      $timevalue = bin2hex ($timercvd[0]);

      $timevalue = abs (HexDec('7fffffff') - HexDec($timevalue) - HexDec('7fffffff')) ;

      $tmestamp = $timevalue - 2208988800; # convert to UNIX epoch time stamp

      $datum = date("Y-m-d (D) H:i:s",$tmestamp - date("Z",$tmestamp)); /* incl time zone offset */

      $doy = (date("z",$tmestamp)+1);

     

      echo "Time check from time server ",$timeserver," : [<font color=\"red\">",$timevalue,"</font>]";

      echo " (seconds since 1900-01-01 00:00.00).<br>\n";

      echo "The current date and universal time is ",$datum," UTC. ";

      echo "It is day ",$doy," of this year.<br>\n";

      echo "The unix epoch time stamp is $tmestamp.<br>\n";

    } #if (!$timercvd)

    else {

      echo "Unfortunately, the time server $timeserver could not be reached at this time. ";

      echo "$timercvd[1] $timercvd[2].<br>\n";

    } # else

    ?>

  5. Hello,

    I am working on combining my old mailing script with a tutorial i found on sending an attachment.

     

    now I have run into a wall, though its probably something dumb i am forgetting. The page instantly echos my error for sendmail "Oops!  You forgot to fill out the email address! Click on the back arrow to go back"

     

    <?
    
    ////   functions  ///////////////////////////////////////
    
    function sendMail() {
      if (!isset ($_POST['to_email'])) { //Oops, forgot your email addy!
        die ("<p>Oops!  You forgot to fill out the email address! Click on the back arrow to go back</p>");
      }
      else {
        
        $from_name = stripslashes($_POST['from_name']);
        $from_email = stripslashes($_POST['from_email']);
        $to_name = stripslashes($_POST['to_name']);
        $to_email = stripslashes($_POST['to_email']);
        $firstname = stripslashes($_POST['firstname']);
        $lastname = stripslashes($_POST['lastname']);
        $phone = stripslashes($_POST['phone']);
        $fax = stripslashes($_POST['fax']);
        $address = stripslashes($_POST['address']);
        $address2 = stripslashes($_POST['address2']);
        $state = stripslashes($_POST['state']);
        $city = stripslashes($_POST['city']);
        $zip = stripslashes($_POST['zip']);
        $email = stripslashes($_POST['email']);
        $available = stripslashes($_POST['available']);
        $livein = stripslashes($_POST['livein']);
        $overnights = stripslashes($_POST['overnights']);
        $travel = stripslashes($_POST['travel']);
        $fulltime = stripslashes($_POST['fulltime']);
        $parttime = stripslashes($_POST['parttime']);
        $comment = stripslashes($_POST['comment']);
        $agreement = stripslashes($_POST['agreement']);
        $resume = $_FILES['resume']['tmp_name'];
        $resume_name = $_FILES['resume']['name'];
            if (is_uploaded_file($resume))    { //Do we have a file uploaded?
                $fp = fopen($resume, "rb"); //Open it
                $data = fread($fp, filesize($resume)); //Read it
                $data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can be emailed
                    fclose($fp);
                }
    
    //Let's start our headers
        ini_set(SMTP, "mail.thenannygroup.com");
        ini_set(smtp_port, 25);
        ini_set(sendmail_from, "web@thenannygroup.com");
        $headers = "From: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "Reply-To: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; 
        $headers .= "X-Sender: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "X-Mailer: PHP4\n";
        $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
        $headers .= "Return-Path: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "This is a multi-part message in MIME format.\n";
        $headers .= "------=MIME_BOUNDRY_main_message \n"; 
        $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
        
        $message = "------=MIME_BOUNDRY_message_parts\n";
        $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; 
        $message .= "Content-Transfer-Encoding: quoted-printable\n"; 
        $message .= "\n"; 
        /* Add our message, in this case it's plain text.  You could also add HTML by changing the Content-Type to text/html */
        $message .= "TheNannyGroup.com - You have a new nanny applicant!
        
        
            Personal Information
            
            First Name = {$firstname} 
            Last Name = {$lastname}
            Phone = {$phone}
            Fax = {$fax}
            Address = {$address}
            Unit = {$address2}
            State = {$state}
            City = {$city}
            Zip = {$zip}
            Email = {$email}
            
        
            Employment Information
            
            Date Available = {$available}
            Live In = {$livein}
            Overnights = {$overnights}
            Travel = {$travel}
            Full Time = {$fulltime}
            Part Time = {$parttime}
            
            
            Other Information
            
            Comment = {$comment}\n";
        
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_message_parts--\n"; 
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message\n"; 
        $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $resume_name . "\"\n";
        $message .= "Content-Transfer-Encoding: base64\n";
        $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $resume_name . "\"\n\n";
        $message .= $data; //The base64 encoded message
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message--\n";
        
        //Send the message
        
    mail("to_name<$to_email>", $subject, $message, $headers);
        echo "Mail Sent. Thank you for your interest.";
    
        //--> adding entry to the DB on successful Mail Send
        Enter_New_Entry($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement);
        }
    }
    
    function Enter_New_Entry 
    ($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement) {
    
    $cnx = mysql_connect("localhost","**********","**********");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
    $db_selected = mysql_select_db('*********', $cnx);
    if (!$db_selected) {
        die ('Can\'t use Records Database : ' . mysql_error());
    }
    
        $SQL_Exec_String = "Insert Into ******** (firstname, lastname, phone, fax, address, address2, state, city, zip, email, available, livein, overnights, travel, fulltime, parttime, comment, agreement)
                Values ('$firstname', '$lastname', '$phone', '$fax', '$address', '$address2', '$state', '$city', '$zip', '$email', '$available', '$livein', '$overnights', '$travel', '$fulltime', '$parttime', '$comment', '$agreement')";
    
        $cur = mysql_query($SQL_Exec_String);
        if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    
    mysql_close($cnx);  
    header("location: http://www.thenannygroup.com/verify.php"); 
    
    }
    
    ////   code  ///////////////////////////////////////
    
    sendMail();
    
    ?>
    

     

     

    anyone see something that catches thier eye?

     

    Thanks

    croix

  6. Hello,

     

    What I am currently working on is a web form that emails me the info submitted, along with an attached file, and writes the info to the database (minus the attachment, im not getting that deep yet)

     

    The code is a combination of a mail script I have been using for a while, and a tutorial I found online. Im having trouble combining the two. My first problem is probably something stupid, though im sure there will be more.

     

    Parse error: syntax error, unexpected T_STRING in /home/sliquidc/public_html/thenannygroup/apply.php on line 96

     

    96 is the mail($to_email, $subject ....... line - and also part of the code from the tutorial.

     

    <?php
    
    function sendMail() {
      if (!isset ($_POST['agreement'])) { //Oops, you did not agree to our terms
        die ("<p>Oops!  You did not agree to our Terms of Employment! Click on the back arrow to go back</p>");
      }
      else {
        
    
    $from_name = stripslashes($_POST['from_name']);
    $from_email = stripslashes($_POST['from_email']);
    $to_email = stripslashes($_POST['to_email']);
    $firstname = stripslashes($_POST['firstname']);
    $lastname = stripslashes($_POST['lastname']);
    $phone = stripslashes($_POST['phone']);
    $fax = stripslashes($_POST['fax']);
    $address = stripslashes($_POST['address']);
    $address2 = stripslashes($_POST['address2']);
    $state = stripslashes($_POST['state']);
    $city = stripslashes($_POST['city']);
    $zip = stripslashes($_POST['zip']);
    $email = stripslashes($_POST['email']);
    $available = stripslashes($_POST['available']);
    $livein = stripslashes($_POST['livein']);
    $overnights = stripslashes($_POST['overnights']);
    $travel = stripslashes($_POST['travel']);
    $fulltime = stripslashes($_POST['fulltime']);
    $parttime = stripslashes($_POST['parttime']);
    $comment = stripslashes($_POST['comment']);
    $agreement = stripslashes($_POST['agreement']);
    $resume = $_FILES['resume']['tmp_name'];
    $resume_name = $_FILES['resume']['name'];
    	if (is_uploaded_file($resume))	{ //Do we have a file uploaded?
    		$fp = fopen($resume, "rb"); //Open it
    		$data = fread($fp, filesize($resume)); //Read it
    		$data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can be emailed
    			fclose($fp);
    		}
    
    //Let's start our headers
    ini_set(SMTP, "mail.thenannygroup.com");
    ini_set(smtp_port, 25);
    ini_set(sendmail_from, "web@thenannygroup.com");
        $headers = "From: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "Reply-To: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "MIME-Version: 1.0\n";
        $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; 
        $headers .= "X-Sender: $from_name<" . $_POST['from_email'] . ">\n";
        $headers .= "X-Mailer: PHP4\n";
        $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
        $headers .= "Return-Path: <" . $_POST['from_email'] . ">\n"; 
        $headers .= "This is a multi-part message in MIME format.\n";
        $headers .= "------=MIME_BOUNDRY_main_message \n"; 
        $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
    
    $message = "------=MIME_BOUNDRY_message_parts\n";
        $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; 
        $message .= "Content-Transfer-Encoding: quoted-printable\n"; 
        $message .= "\n"; 
        /* Add our message, in this case it's plain text.  You could also add HTML by changing the Content-Type to text/html */
        $message .= "<strong>TheNannyGroup.com</strong> - You have a new nanny applicant!<br><br>
    	<strong>Personal Information</strong><br><br>
    	First Name = {$firstname} 
    	Last Name = {$lastname}
    	Phone = {$phone}
    	Fax = {$fax}
    	Address = {$address}
    	Unit = {$address2}
    	State = {$state}
    	City = {$city}
    	Zip = {$zip}
    	Email = {<a href=\"mailto:$email\">$email</a>}<br><br><br>
    	<strong>Employment Information</strong><br><br>
    	Date Available = {$available}
    	Live In = {$livein}
    	Overnights = {$overnights}
    	Travel = {$travel}
    	Full Time = {$fulltime}
    	Part Time = {$parttime}<br><br><br>
    	<strong>Other Information</strong><br><br>
    	Comment = {$comment}\n";
    
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_message_parts--\n"; 
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message\n"; 
        $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $resume_name . "\"\n";
        $message .= "Content-Transfer-Encoding: base64\n";
        $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $resume_name . "\"\n\n";
        $message .= $data; //The base64 encoded message
        $message .= "\n"; 
        $message .= "------=MIME_BOUNDRY_main_message--\n"
    
    //Send the message
    mail("to_name<$to_email>", $subject, $message, $headers);
    print "Mail Sent. Thank you for your interest.";
    }
    }
    
    Enter_New_Entry($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement);
    
    function Enter_New_Entry 
    ($firstname,$lastname,$phone,$fax,$address,$address2,$state,$city,$zip,$email,$available,$livein,$overnights,$travel,$fulltime,$parttime,$comment,$agreement) {
    
    $cnx = mysql_connect("localhost","**********","**********");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
    $db_selected = mysql_select_db('**********', $cnx);
    if (!$db_selected) {
        die ('Can\'t use Records Database : ' . mysql_error());
    }
    
        $SQL_Exec_String = "Insert Into applicants (firstname, lastname, phone, fax, address, address2, state, city, zip, email, available, livein, overnights, travel, fulltime, parttime, comment, agreement)
                Values ('$firstname', '$lastname', '$phone', '$fax', '$address', '$address2', '$state', '$city', '$zip', '$email', '$available', '$livein', '$overnights', '$travel', '$fulltime', '$parttime', '$comment', '$agreement')";
    
        $cur = mysql_query($SQL_Exec_String);
        if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    
    mysql_close($cnx);  
    header("location: http://www.thenannygroup.com/verify.php"); 
    
    }
    
    ?>

     

    I thought it was just unescaped quotes on line 96, but i tried to escape them, and it made no difference.

     

    you guys see anything, or have a better direction to point me in?

     

    Thanks

    Croix

  7. I can never figure out how to properly echo or print my errors so I can find the problem. My form is not entering the information to the database, its not emailing the information, and its not redirecting to the page listed in the header. It seems like it just refreshes the page.

     

    can someone tell me a good way to find where the error is? I am trying to print the $message, but apparently Im not doing it right. I know its not the database connection, because I know how to test that, and i did at www.ridelube.com/dbtest.php

     

    <?php
    
    if (isset($_POST['name'])) {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $fax = $_POST['fax'];
    $company = $_POST['company'];
    $address = $_POST['address'];
    $address2 = $_POST['address2'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $website = $_POST['website'];
    $type = $_POST['type'];
    $comment = $_POST['comment'];
    
    $msg = "Attention Ride Lubricant! You have a new vendor request!<br><br>
    Name = {$name} <br>
    Company = {$company}<br>
    Type = {$type}
    Address = {$address1}<br>
    Unit = {$address2}<br>
    City = {$city}<br>
    State = {$state}<br>
    Zip = {$zip}<br>
    Phone = {$phone}<br>
    Fax = {$fax}<br>
    Email = {$email}
    Website = {$website}
    Comment = {$comment}";
    
    Enter_New_Entry($name,$email,$phone,$fax,$company,$address,$address2,$city,$state,$zip,$website,$type,$comment);
    
    //ini_set(SMTP, "smtp.ridelube.com");
    ini_set(SMTP, "mail.ridelube.com");
    ini_set(smtp_port, 25);
    ini_set(sendmail_from, "sales@ridelube.com");
    $headers = "From: sales@ridelube.com\r\n";
    $headers .= "BCC: dean@ridelube.com\r\n";
    //mail(To, subject, content, header);
    $to = "sales@ridelube.com";
    $result  = mail($to, "New Ride Lube Vendor Request", $msg, $headers);
    if( $result == 0 ) {
    	echo "error <br>";
    
    }
    }
    function Enter_New_Entry 
    ($name,$email,$phone,$fax,$company,$address,$address2,$city,$state,$zip,$website,$type,$comment) {
    
    $cnx = mysql_connect("localhost","********","*********");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
    $db_selected = mysql_select_db('***********', $cnx);
    if (!$db_selected) {
        die ('Can\'t use Records Database : ' . mysql_error());
    }
    
        $SQL_Exec_String = "Insert Into clients (name, email, phone, fax, company, address, address2, city, state, zip, website, type, comment)
                Values ('$name', '$email', '$phone', '$fax', '$company', '$address', '$address2', '$city', '$state', '$zip', '$website', '$type', '$comment')";
    
        $cur = mysql_query($SQL_Exec_String);
        if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    
    mysql_close($cnx);  
    header("location: http://www.ridelube.com/verify.htm"); 
    
    }
    ?>
    

  8. Hello,

    I am getting SQL syntax error on a page that I am in the process of converting from Access to MySQL.

     

    Here is the error:

    Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM customers WHERE customerID = 727' at line 1 Whole query: DELETE * FROM customers WHERE customerID = 727

     

    I checked out the MySQL manual, but I don't see anything wrong with my syntax.... maybe Im looking in the wrong place.

     

     

     

    ******EDIT******

     

    I was looking at the wrong documentation...

     

    The proper (and working) syntax was DELETE FROM customers WHERE ....

  9. that did the trick Frost110.... Thanks!

     

    However, it leads me to a new issue.... with my header.

     

     

     

    Record Updated!

    Warning: Cannot modify header information - headers already sent by (output started at /home/sliquidc/public_html/protected/cust_update.php:9) in /home/sliquidc/public_html/protected/cust_update.php on line 9

     

     

    I went through pages and pages of google with this error, but everyones problem was related to CMS programs and extra whitespace being sent to the browser... but Line 9 for me is in the middle of a block of text... no whitespace..

     

    <?php
    ini_set('error_reporting', E_ALL); 
    ini_set('display_errors', 'On');
    
    include("dbconnection.php");
    
    $customerID=$_POST['customerID'];
    $firstname=$_POST['firstname'];
    $lastname=$_POST['lastname'];
    $address1=$_POST['address1'];
    $address2=$_POST['address2'];
    $city=$_POST['city'];
    $state=$_POST['state'];
    $zip=$_POST['zip'];
    $email=$_POST['email'];
    $referral=$_POST['referral'];
    $promo=$_POST['promo'];
    $lubricant=$_POST['lubricant'];
    
    $query="UPDATE customers SET firstname = '$firstname', lastname = '$lastname', address1 = '$address1', address2 = '$address2', city = '$city', state = '$state', zip = '$zip', email = '$email', referral = '$referral', promo = '$promo', lubricant = '$lubricant' WHERE customerID = $customerID";
    $cur = mysql_query($query);
    if (!$cur) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
    }
    else
    {
    echo "Record Updated!";
    }
    mysql_close($cnx);
    header("Refresh: 2; URL=http://69.89.31.71/~sliquidc/protected/cust_search.php");
    echo " "; // NN4 requires that we output something...
    exit();
    ?>
    

  10. I have a site that has been running fine on a windows server / access database.

     

    I am in the process of moving to a new linux server with mysql.

     

    On the site, I have an admin page, that has functions to add / delete / update / edit records from the database.

     

    I have already migrated the tables and data, and I have gotten the add record function to work on the new setup.

     

    Now I am working on the edit record part, and I am getting this error:

     

    Notice: Undefined index: firstname

    etc listing all of my variables.

     

    Google tells me that this problem usually occurs when the code is not calling all of the variables, but I dont think thats the case in my situation.

     

    Here is my code:

    <?php
    ini_set('error_reporting', E_ALL); 
    ini_set('display_errors', 'On');
    
    include("dbconnection.php");
    $id=$_GET['customerID']; 
    $query = "SELECT * FROM customers WHERE customerID= $id ";
    $result = mysql_query($query); 
         while($row = mysql_fetch_array($result)) 
                 { 
    $firstname = $row['firstname'];
    $lastname = $row['lastname'];
    $address1 = $row['address1'];
    $address2 = $row['address2'];
    $city = $row['city'];
    $state = $row['state'];
    $zip = $row['zip'];
    $email = $row['email'];
    $referral = $row['referral'];
    $promo = $row['promo'];
    $lubricant = $row['lubricant'];
    
    $results = "
      <div id=\"table1\"><center>
    <form action=\"cust_update.php\" method=\"post\">
      <div align=\"left\"><input type=\"hidden\" name=\"customerID\" value=\"$id\">
        <table width=349 height=\"91\" border=\"0\">
          <tr>
            <td width=174 height=\"81\"><p>First Name:<br> 
                  <input type=\"text\" name=\"firstname\" value=\"$firstname\">
            </p>          </td>
            <td width=165><p>Last Name:<br> 
                  <input type=\"text\" name=\"lastname\" value=\"$lastname\">
            </p>          </td>
          </tr>
          <tr>
            <td>Address:<br> 
        <input type=\"text\" name=\"address1\" value=\"$address1\"></td>
            <td>Address 2:<br> 
        <input type=\"text\" name=\"address2\" value=\"$address2\"></td>
          </tr>
          <tr>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>City:<br> 
                    <input type=\"text\" name=\"city\" value=\"$city\">
              </p></td>
            <td><p></p>
              <p>State:<br> 
                    <input type=\"text\" name=\"state\" value=\"$state\">
              </p></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Zip:<br> 
                    <input type=\"text\" name=\"zip\" value=\"$zip\">
              </p></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Email:<br> 
                    <input type=\"text\" name=\"email\" value=\"$email\">
              </p></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Referral:<br> 
                    <input type=\"text\" name=\"referral\" value=\"$referral\">
              </p></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Promo:<br> 
                    <input type=\"text\" name=\"promo\" value=\"$promo\">
              </p></td>
            <td><p></p>
              <p>Lubricant:<br> 
                    <input type=\"text\" name=\"lubricant\" value=\"$lubricant\">
              </p></td>
          </tr>
          <tr>
            <td></td>
            <td></td>
          </tr>
        </table>
        <p><br>
            <input type=\"Submit\" value=\"Update\">
            </p></form><br>
    
    	<form action=\"cust_delete.php\" method=\"post\">
    <input type=\"hidden\" name=\"customerID\" value=\"$id\">
    <input type=\"submit\" value=\"Delete Record\">
    </form>
    
      </div>
    
    </center>
    </div>
    ";
    }
    ?>

     

    anyone see something that catches thier eye?

  11. OK, Im not sure why error_handler was working on the old server, but I changed it.

     

    Here's the error Im getting now when I submit the form:

     

    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/sliquidc/public_html/become.php on line 47

    Invalid query:

     

    $cnx = mysql_connect("localhost","user_name","user_pass");
        if (!$cnx) {
            die('Could not connect: ' . mysql_error());
        }
    
        $SQL_Exec_String = "Insert Into distributors (company, firstname, lastname, address1, address2, city, state, zip, country, outside_us, phone, website, fax, email, store_type, comments, referral)
                Values ('$company', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$outside_us', '$phone', '$website', '$fax', '$email', '$store_type', '$comments', '$referral')";
    
        $cur = mysql_query($cnx, $SQL_Exec_String);
        if (!$cur) {
            die('Invalid query: ' . mysql_error());
    }
    
    mysql_close($cnx);  
    header("location: http://69.89.31.71/~sliquidc/verify.htm"); 
    
    }
    

  12. i cant find a way to edit my post, so Im just going to have to add new information.

     

    I changed my script to point back to itself instead of the old host, as well as my header.

     

    Now I am getting an error

    <b>

    Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/sliquidc/public_html/become.php on line 47

     

    Fatal error: Call to undefined function error_handler() in /home/sliquidc/public_html/become.php on line 49</b>

     

    This is where the error is reporting:

        $cur= mysql_query( $cnx, $SQL_Exec_String );
        if (!$cur) {
            Error_handler( "Error in mysql_query( no cursor returned ) " , $cnx );
    

     

    here is the whole code:

    <?php
    
    if (isset($_POST['company'])) {
    $company = $_POST['company'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $address1 = $_POST['address1'];
    $address2 = $_POST['address2'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $country = $_POST['country'];
    $outside_us = $_POST['outside_us'];
    $phone = $_POST['phone'];
    $website = $_POST['website'];
    $fax = $_POST['fax'];
    $email = $_POST['email'];
    $store_type = $_POST['store_type'];
    $comments = $_POST['comments'];
    $referral = $_POST['referral'];
    
    $msg = "Attention Sliquid! You have a new vendor request!
    Company Name = {$company} 
    First Name = {$firstname}
    Last Name = {$lastname}
    Address = {$address1}
    Address 2 = {$address2}
    City = {$city}
    State = {$state}
    Zip = {$zip}
    Country = {$country}
    Shipping Info = {$outside_us}
    Phone = {$phone}
    Website = {$website}
    Fax = {$fax}
    Email = {$email}
    Store Type = {$store_type}
    Comments = {$comments}
    Referred By = {$referral}";
    
    Enter_New_Entry($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral);
    
    //ini_set(SMTP, "smtp.sliquid.com");
    ini_set(SMTP, "mail.sliquid.com");
    ini_set(smtp_port, 25);
    ini_set(sendmail_from, "sales@sliquid.com");
    $headers = "From: sales@sliquid.com\r\n";
    $headers .= "BCC: dean@sliquid.com\r\n";
    //mail(To, subject, content, header);
    $to = "sales@sliquid.com";
    $result  = mail($to, "New Vendor Request", $msg, $headers);
    if( $result == 0 ) {
    	echo "error <br>";
    
    }
    }
    function Enter_New_Entry 
    ($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral) {
    
    $cnx = mysql_connect("localhost","user_name","password");
        if (!$cnx) {
            Error_handler("Error in mysql_connect",$cnx);
        }
    
        $SQL_Exec_String = "Insert Into distributors (company, firstname, lastname, address1, address2, city, state, zip, country, outside_us, phone, website, fax, email, store_type, comments, referral)
                Values ('$company', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$outside_us', '$phone', '$website', '$fax', '$email', '$store_type', '$comments', '$referral')";
    
        $cur= mysql_query( $cnx, $SQL_Exec_String );
        if (!$cur) {
            Error_handler( "Error in mysql_query( no cursor returned ) " , $cnx );
    }
    
    mysql_close($cnx);  
    header("location: http://69.89.31.71/~sliquidc/verify.htm"); 
    
    }
    
    ?>
    

  13. OK, i got a test db connection page to work...

     

    <html>
    <head>
    <title>MySQL database test</title>
    </head>
    <body>
    
    <?php
    
    if (!($db = 
    mysql_connect("localhost","user_name","my_password"))) {
            print ("Unable to connect to database host: $_db_host");
            errorEmail();
            exit;
    }
    
    if (!(mysql_select_db("db_name",$db)))  {
            print ("Unable to select database: $_db_name");
            errorEmail();
            exit;
    }
    
    print "<p>Database connection successful.<br /></p>";
    
    
    ?>
    
    </body>
    </html>
    

     

    when I access this page, it echos "Database connection successful"

     

    however, when I run my original script:

    function Enter_New_Entry 
    ($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral) {
    
    $cnx = mysql_connect("localhost","user_name","my_password");
        if (!$cnx) {
            Error_handler( "Error in mysql_connect" , $cnx );
        }
    
        $SQL_Exec_String = "Insert Into distributors (company, firstname, lastname, address1, address2, city, state, zip, country, outside_us, phone, website, fax, email, store_type, comments, referral)
                Values ('$company', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$outside_us', '$phone', '$website', '$fax', '$email', '$store_type', '$comments', '$referral')";
    
        $cur= mysql_query( $cnx, $SQL_Exec_String );
        if (!$cur) {
            Error_handler( "Error in mysql_query( no cursor returned ) " , $cnx );
    }
    
    mysql_close($cnx);  
    header("location: http://www.sliquid.com/verify.htm"); 
    
    }
    
    ?>

     

    nothing is inserted into the database...

    no error message is returned...

    and because of my submit to and my header redirect, it takes me to my old host...

     

     

    looking at it, it seems that the dbtest script has a line that references the database name, where the form does not.

     

    how can i modify the script to contain the reference to the database name, or is there a better way to accomplish this?

     

  14. OK, I have a new host, and thus I now have the ability to use MySQL instead of Access.

     

    I have a simple script, which I need to convert the code to utilize the new database. I will worry about migrating the content aft er I get teh script working.

     

    OK, here's the current code:

     

    <?php
    
    if (isset($_POST['company'])) {
    $company = $_POST['company'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $address1 = $_POST['address1'];
    $address2 = $_POST['address2'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $country = $_POST['country'];
    $outside_us = $_POST['outside_us'];
    $phone = $_POST['phone'];
    $website = $_POST['website'];
    $fax = $_POST['fax'];
    $email = $_POST['email'];
    $store_type = $_POST['store_type'];
    $comments = $_POST['comments'];
    $referral = $_POST['referral'];
    
    $msg = "Attention Sliquid! You have a new vendor request!
    Company Name = {$company} 
    First Name = {$firstname}
    Last Name = {$lastname}
    Address = {$address1}
    Address 2 = {$address2}
    City = {$city}
    State = {$state}
    Zip = {$zip}
    Country = {$country}
    Shipping Info = {$outside_us}
    Phone = {$phone}
    Website = {$website}
    Fax = {$fax}
    Email = {$email}
    Store Type = {$store_type}
    Comments = {$comments}
    Referred By = {$referral}";
    
    Enter_New_Entry($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral);
    
    //ini_set(SMTP, "smtp.sliquid.com");
    ini_set(SMTP, "mail.sliquid.com");
    ini_set(smtp_port, 25);
    ini_set(sendmail_from, "sales@sliquid.com");
    $headers = "From: sales@sliquid.com\r\n";
    $headers .= "BCC: dean@sliquid.com\r\n";
    //mail(To, subject, content, header);
    $to = "sales@sliquid.com";
    $result  = mail($to, "New Vendor Request", $msg, $headers);
    if( $result == 0 ) {
    	echo "error <br>";
    
    }
    }
    function Enter_New_Entry 
    ($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral) {
    
    $cnx = odbc_connect( 'records_db' , '******', '********' );
        if (!$cnx) {
            Error_handler( "Error in odbc_connect" , $cnx );
        }
    
        $SQL_Exec_String = "Insert Into distributors (company, firstname, lastname, address1, address2, city, state, zip, country, outside_us, phone, website, fax, email, store_type, comments, referral)
                Values ('$company', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$outside_us', '$phone', '$website', '$fax', '$email', '$store_type', '$comments', '$referral')";
    
        $cur= odbc_exec( $cnx, $SQL_Exec_String );
        if (!$cur) {
            Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
    }
    
    odbc_close($cnx);  
    header("location: http://www.sliquid.com/verify.htm"); 
    
    }
    
    ?>

     

    I found out how to change my db connection to mysql, but im lost on teh other parts (mysql_connect, mysql_exec?)

     

    any ideas, solutions, or links to something that will show me all the equivalent functions between access and mysql?

     

    Thanks

    \colin

  15. OK, so my host decided to change up our mail server, and now my mail function in PHP does not work, because I now need SMTP authentication.

    I know the typical mail function does not provide for SMTP authentication, but there is a workaround with PEAR.

    But, I dont quite get it.

    So here is my existing mail code:

    [CODE]<?php

    if (isset($_POST['company'])) {
    $company = $_POST['company'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $address1 = $_POST['address1'];
    $address2 = $_POST['address2'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $zip = $_POST['zip'];
    $country = $_POST['country'];
    $outside_us = $_POST['outside_us'];
    $phone = $_POST['phone'];
    $website = $_POST['website'];
    $fax = $_POST['fax'];
    $email = $_POST['email'];
    $store_type = $_POST['store_type'];
    $comments = $_POST['comments'];
    $referral = $_POST['referral'];

    $msg = "Attention Sliquid! You have a new vendor request!
    Company Name = {$company}
    First Name = {$firstname}
    Last Name = {$lastname}
    Address = {$address1}
    Address 2 = {$address2}
    City = {$city}
    State = {$state}
    Zip = {$zip}
    Country = {$country}
    Shipping Info = {$outside_us}
    Phone = {$phone}
    Website = {$website}
    Fax = {$fax}
    Email = {$email}
    Store Type = {$store_type}
    Comments = {$comments}
    Referred By = {$referral}";

    Enter_New_Entry($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral);

    ini_set(SMTP, "smtp.sliquid.com");
    ini_set(smtp_port, 25);
    ini_set(sendmail_from, "sales@sliquid.com");
    $headers = "From: sales@sliquid.com\r\n";
    $headers .= "BCC: dean@sliquid.com\r\n";
    //mail(To, subject, content, header);
    $to = "sales@sliquid.com";
    $result  = mail($to, "New Vendor Request", $msg, $headers);
    if( $result == 0 ) {
    echo "error <br>";

    }
    }
    function Enter_New_Entry
    ($company,$firstname,$lastname,$address1,$address2,$city,$state,$zip,$country,$outside_us,$phone,$website,$fax,$email,$store_type,$comments,$referral) {

    $cnx = odbc_connect( 'records_db' , 'Admin', '********' );
        if (!$cnx) {
            Error_handler( "Error in odbc_connect" , $cnx );
        }

        $SQL_Exec_String = "Insert Into distributors (company, firstname, lastname, address1, address2, city, state, zip, country, outside_us, phone, website, fax, email, store_type, comments, referral)
                Values ('$company', '$firstname', '$lastname', '$address1', '$address2', '$city', '$state', '$zip', '$country', '$outside_us', '$phone', '$website', '$fax', '$email', '$store_type', '$comments', '$referral')";

        $cur= odbc_exec( $cnx, $SQL_Exec_String );
        if (!$cur) {
            Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
    }

    odbc_close($cnx); 
    header("location: http://www.sliquid.com/verify.htm");

    }

    ?>
    [/CODE]


    and here is what I have found on the PEAR workaround:

    [CODE]<?php
    require_once "Mail.php";

    $from = "Sandra Sender <sender@example.com>";
    $to = "Ramona Recipient <recipient@example.com>";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";

    $host = "mail.example.com";
    $username = "smtp_username";
    $password = "smtp_password";

    $headers = array ('From' => $from,
      'To' => $to,
      'Subject' => $subject);
    $smtp = Mail::factory('smtp',
      array ('host' => $host,
        'auth' => true,
        'username' => $username,
        'password' => $password));

    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
      echo("<p>" . $mail->getMessage() . "</p>");
    } else {
      echo("<p>Message successfully sent!</p>");
    }
    ?>[/CODE]


    anyone got a quick lesson or link on how to adapt this?
  16. [code]
    <?php

    ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 'On');

    include("dbconnection.php");

    //echo "
    //";
    //print_r($_POST);
    //echo "
    //";

    $customerID=$_GET['customerID'];


    //foreach($_GET as $key => $value)
    //{

    //  ${$key} = $value;
    //}

    $query="DELETE FROM customers VALUES * WHERE customerID = $customerID";
    odbc_exec($cnx, $query);
    if (!odbc_exec($cnx, $query))
    {
    echo odbc_errormsg($cnx);
    }
    else
    {
    echo "Record Deleted!";
    }
    odbc_close($cnx);

    header("Refresh: 2; URL=http://sliquid.com/protected/cust_search.php");
    echo " "; // NN4 requires that we output something...
    exit();
    ?>[/code]

    ok, now im getting the button, but using it gives me this error:
    [b]Notice: Undefined variable: customerID in d:\inetpub\sliquid\wwwRoot\protected\cust_delete.php on line 16

    Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause., SQL state 37000 in SQLExecDirect in d:\inetpub\sliquid\wwwRoot\protected\cust_delete.php on line 16

    Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause., SQL state 37000 in SQLExecDirect in d:\inetpub\sliquid\wwwRoot\protected\cust_delete.php on line 16
    [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.[/b]

    so obviously i need to fix my undefined variable first off. why is it undefined? is it not receiving the GET variable from the last page?
  17. [code]
    <?php
    ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 'On');

    include("dbconnection.php");
    $id=$_GET['customerID'];
    $query = "SELECT * FROM customers WHERE customerID= $id ";
    $result = odbc_exec($cnx, $query);
         while($row = odbc_fetch_array($result))
                 {
    $firstname = $row['firstname'];
    $lastname = $row['lastname'];
    $address1 = $row['address1'];
    $address2 = $row['address2'];
    $city = $row['city'];
    $state = $row['state'];
    $zip = $row['zip'];
    $email = $row['email'];
    $referral = $row['referral'];
    $promo = $row['promo'];
    $lubricant = $row['lubricant'];

    $results = "
      <div id=\"table1\"><center>
    <form action=\"cust_update.php\" method=\"post\">
      <div align=\"left\"><input type=\"hidden\" name=\"customerID\" value=\"$id\">
        <table width=349 height=\"91\" border=\"0\">
          <tr>
            <td width=174 height=\"81\"><p>First Name:<br>
                  <input type=\"text\" name=\"firstname\" value=\"$firstname\">
            </p>          </td>
            <td width=165><p>Last Name:<br>
                  <input type=\"text\" name=\"lastname\" value=\"$lastname\">
            </p>          </td>
          </tr>
          <tr>
            <td>Address:<br>
        <input type=\"text\" name=\"address1\" value=\"$address1\"></td>
            <td>Address 2:<br>
        <input type=\"text\" name=\"address2\" value=\"$address2\"></td>
          </tr>
          <tr>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>City:<br>
                    <input type=\"text\" name=\"city\" value=\"$city\">
              </p></td>
            <td><p></p>
              <p>State:<br>
                    <input type=\"text\" name=\"state\" value=\"$state\">
              </p></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Zip:<br>
                    <input type=\"text\" name=\"zip\" value=\"$zip\">
              </p></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Email:<br>
                    <input type=\"text\" name=\"email\" value=\"$email\">
              </p></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Referral:<br>
                    <input type=\"text\" name=\"referral\" value=\"$referral\">
              </p></td>
            <td></td>
          </tr>
          <tr>
            <td><p></p>
              <p>Promo:<br>
                    <input type=\"text\" name=\"promo\" value=\"$promo\">
              </p></td>
            <td><p></p>
              <p>Lubricant:<br>
                    <input type=\"text\" name=\"lubricant\" value=\"$lubricant\">
              </p></td>
          </tr>
          <tr>
            <td></td>
            <td></td>
          </tr>
        </table>
        <p><br>
            <input type=\"Submit\" value=\"Update\">
            </p></form><br>

    <form action=\"cust_delete.php\" method=\"post\">
    <input type=\"hidden\" name=\"cust_id\" value=\"<?=$_GET['customerID'];?>\">
    <input type=\"submit\" value=\"Delete\">
    </form>

      </div>

    </center>
    </div>
    ";
    }
    ?>
    [/code]

    so thats what i tried, and what i get is a blank page.
    if i just take out the second form, it works fine.

    I think the value for the second submit button is wrong, but what should it be if not delete?

    ***edit
    looking at the way the forum posted the bottom of the code, im thinking something is wrong there.
×
×
  • 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.