Jump to content

Akku
 Share

Recommended Posts

Hi there,

 

Is there any mistake in the following code?

 


        <?php
        if(isset($_POST['submit']))
        {
            $fname=$_POST['fname'];
            $lname=$_POST['lname'];
            $email=$_POST['email'];
            $phone=$_POST['phone'];
            $cname=$_POST['cname'];
            $reason=$_POST['reason'];
            $web=$_POST['web'];
            $smart=$_POST['smart'];
            $im=$_POST['im'];
            $cd=$_POST['cd'];
            $ms=$_POST['ms'];
            
            
            $con='Firstname:'.$fname."<br>Lastname:".$lname."<br>Email:".$email."<br>Phone:".$phone."<br>Company:".$cname."<br>Reason:".$reason."<br>".$web."<br>".$smart."<br>".$im."<br>".$cd."<br>".$ms;
            $to="aaa@bbb.com";
            $sub="invoice";
            mail($to,$sub,$con);
            if( mail($to,$sub,$con))
            {
                echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
            }
            
        }
        
        ?>

Link to comment
Share on other sites

testing script

        $_POST['submit'] = "yes";
        if (isset($_POST['submit'])) {
            $fname = $_POST['fname'] = "fred";
            $lname = $_POST['lname'] = "flintstone";
            $email = $_POST['email'] = "this@mail.com";
            $phone = $_POST['phone'] = "0123456789";
            $cname = $_POST['cname'] = "what";
            $reason = $_POST['reason'] = "because i said so";
            $web = $_POST['web'] = "spiders";
            $smart = $_POST['smart'] = "very";
            $im = $_POST['im'] = "md";
            $cd = $_POST['cd'] = "cd";
            $ms = $_POST['ms'] = "ms";
            var_dump($_POST);

            $con = 'Firstname:' . $fname . "\nLastname:" . $lname . "\nEmail:" . $email . "\nPhone:" . $phone . "\nCompany:" . $cname . "\nReason:" . $reason . "\n" . $web . "\n" . $smart . "\n" . $im . "\n" . $cd . "\n" . $ms;
            $to = "aaa@bbb.com";
            $sub = "invoice";

            if (mail($to, $sub, $con)) {
                echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
            } else {
                echo "ERROR, ERROR Doctor Smith ERROR";
            }
        }

if it works, then you need to make sure the $_POST array values and required 'submit value is getting to this script. the var_dump($_POST); will show what is sent.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...