Jump to content

[SOLVED] Identical code works on one server but doesn't on the other


LaWebMaster

Recommended Posts

Hello all,

 

This is my first post.  I do not have extensive knowledge of PHP or SQL.  I successfully integrated some PHP code onto a webserver and configured it with SQL and it works fine.  This is the code:

 

<?php
session_start();

    if ($_POST)
    {
        include 'config.php';
        include 'opendb.php';

        $query = "INSERT INTO applications (title, legal_name, email_address, home_phone, contact_time, other_phone, other_phone_source, source, step) VALUES ('" . 
        $_POST['title'] . "', '" . $_POST['legal_name'] . "', '" . $_POST['email'] . "', '" . $_POST['phone_no'] . "', '" . $_POST['contact_when'] . "', '" .
        $_POST['other_phone_no']  . "', '" . $_POST['other_phone_no_is'] . "','canadian_applynow','step1')";

        mysql_query($query);
        
        $_SESSION['application_id'] = mysql_insert_id();

        header('Location: step2.php');
        
        include 'closedb.php';        
    }
?>

 

& step2.php

 

<?php
session_start();

    if ($_POST)
    {
        include 'config.php';
        include 'opendb.php';

      $query = "UPDATE applications SET step='step2', apply='" . $_POST['payment_type'] . "', fine='" . $_POST['fines']  . "', mailing_address='" . $_POST['address'] . "', city='" . $_POST['city'] . "', province='" . $_POST['province'] . "', postal_code='" . $_POST['postal_code']  . "', credit_card_type='" . $_POST['cc_type'] . "', credit_card_name='" . $_POST['cc_name'] . "', credit_card_number='"  . $_POST['cc_number'] . "', credit_card_exp_month='" . $_POST['cc_expiry_month'] . "', credit_card_exp_year='" . $_POST['cc_expiry_year']  .  "', paying_for='" . $_POST['paying_for'] . "', paying_how='" . $_POST['payment'] . "' WHERE id=" . $_SESSION['application_id'];


        mysql_query($query);

        $query = "SELECT * FROM applications WHERE id=" . $_SESSION['application_id'];

        $result = mysql_query($query);

        if ($result)
        {        
            if (mysql_num_rows($result))
            {
                $row = mysql_fetch_array($result);

                $to      = 'x';
                $subject = 'xApplication Form';        
//                $headers = 'From: x' . "\n" .
//                    'Reply-To: x . "\n" .
//                    'X-Mailer: PHP/' . phpversion();

			$headers = "From: x\nReply-To: x";
                
			$message = "Title: " . $row["title"] . "\n";
                $message .= "Name: " . $row["legal_name"] . "\n";
                $message .= "Address: " . $row["mailing_address"] . "\n";
                $message .= "City: " . $row["city"] . "\n";
                $message .= "Province : " . $row["province"] . "\n\n";
                $message .= "Email: " . $row["email_address"] . "\n";
			$message .= "Postal Code: " . $row["postal_code"] . "\n";
                $message .= "Home Phone Number: " . $row["home_phone"] . "\n";
                $message .= "Other Phone Number:  " . $row["other_phone_source"] . "\n";
                $message .= "Other Phone Number is:  " . $row["other_phone"] . "\n";
                $message .= "Best Time to Contact: " . $row["contact_time"] . "\n";
                $message .= "Referer: \n\n";                
                $message .= "Applying for a: " . $row["apply"] . "\n";
                $message .= "Paying How: " . $row["paying_how"] . "\n\n";                
                $message .= "Paying For: " . $row["paying_for"] . "\n";
                $message .= "Credit Card Type: " . $row["credit_card_type"] . "\n";
                $message .= "Name on Card: " . $row["credit_card_name"] . "\n";
                $message .= "Credit Card Number: " . $row["credit_card_number"] . "\n";
                $message .= "Credit Card Expiry: " . $row["credit_card_exp_month"] . " / " . $row["credit_card_exp_year"] . "\n\n";     
                $message .= "Agrees with Terms?: iagree \n\n";     
                $message .= "----------------------------------------\n\n";     
                $message .= "Date Form Submitted: " . date("Y-m-d") . "\n";
                $message .= "Time Form Submitted: " . date("G:i:s") . "\n";

                mail($to, $subject, $message, $headers);
            }   
        }
    
        header('Location: application_success.php');
        
        include 'closedb.php';        
    }
?>

 

I implemented this set of code with the appropriate html forms on one server and it works perfectly, however when I put it up on another server, step 1 posts fine, but step 2 does not.  What could be causing this? I'm really hoping that it is something basic.  Any help is appreciated.

 

Link to comment
Share on other sites

but step 2 does not

 

You've got to help us out by providing information about what it does do to help pin down where to look. Are you getting a blank page? A php error message? No email sent? What have you done to troubleshoot what it is or is not doing, given that we don't have access to your database or your server to investigate what it is doing ourselves.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.