Jump to content

Website Contact Form using PHP


mabolzarichie

Recommended Posts

Hi Guys,

 

What a great site.

 

I have a Contact form on a Flash website which works OK and emails me the contents of the form. I used a script from a site I found and it worked great.

 

However, I have 2 questions. When the contents of the form are emailed back to me, it appears In a light green color. I would like this to be in black so it is easier to read.

 

I have tried to play around with the <FONT> tag, but could not get this to work. A copy of the script is below.

 

Also, when the contents are emailed back to me, I comes from CGI-Mailer [cgi-mailer@kundenserver.de]. Can I somehow change this?

 

Many Thanks

 

 

 

<?php

 

    $your_company = $_GET[‘company’];

    $your_name = $_GET[‘your_name’];

    $your_phone = $_GET[‘phone’];

    $your_email = $_GET[‘email’];

    $your_message = $_GET[‘message’];

   

    // change this to whatever you needed to be.

    $recipient = ‘you@yourdomain.com’;

 

    //you can make it say anything you want

    $subject = ‘Someone has submited your form’;

 

    // Do not edit anything else beyond this point

    $headers .= ‘Content-type: text/html; charset=iso-8859-1′;

 

    $content = "<html><head><title>Contact letter</title></head><body><br />";

    $content .= "Company: <b>" . $your_company . "</b><br />";

    $content .= "Name: <b>" . $your_name . "</b><br />";

    $content .= "Phone: <b>" . $your_phone . "</b><br />";

    $content .= "E-mail: <b>" . $your_email . "</b><br /><hr /><br />";

    $content .= $your_message;

    $content .= "<br /></body>";

   

 

    // The mail() function allows you to send mail.

    mail($recipient,$subject,$content,$headers);

?>

<html>

    <body bgcolor="#282E2C">

        <div align="center" style="margin-top:60px;color:#FFFFFF;font-size:11px;

font-family:Tahoma;font-weight:bold">

            Your message was sent. Thank you.

        </div>

    </body>

</html>

<script>resizeTo(300, 300)</script>

 

Secondly

 

 

Link to comment
Share on other sites

change this part

 

<body bgcolor="#282E2C">

 

to

 

<body bgcolor="#000000">

 

This will change the Background color to black. Your text will be white. Or change it to

 

<body bgcolor="#FFFFFF">

 

and change this part

 

color:#FFFFFF

 

to

 

color:#000000

 

to make it white with black text.

 

 

Link to comment
Share on other sites

change this part

 

<body bgcolor="#282E2C">

 

to

 

<body bgcolor="#000000">

 

This will change the Background color to black. Your text will be white. Or change it to

 

<body bgcolor="#FFFFFF">

 

and change this part

 

color:#FFFFFF

 

to

 

color:#000000

 

to make it white with black text.

 

Ok, so I tried the code above (2nd part to make the text black), but all it does is change the colors on the pop up screen which confirms the message has been sent successfully.

 

On the Email, the name, company, tel etc still show in a different color.

 

 

Link to comment
Share on other sites

Change this:

    $content = "<html><head><title>Contact letter</title></head><body><br />";
    $content .= "Company: <b>" . $your_company . "</b><br />";
    $content .= "Name: <b>" . $your_name . "</b><br />";
    $content .= "Phone: <b>" . $your_phone . "</b><br />";
    $content .= "E-mail: <b>" . $your_email . "</b><br /><hr /><br />";
    $content .= $your_message;
    $content .= "<br /></body>";

to this:

    $content = "<style type='text/css'>body,td,th {color: #FFFFFF;}body {background-color: #000000;}</style>";
    $content .= "<html><head><title>Contact letter</title></head><body><br />";
    $content .= "Company: <b>" . $your_company . "</b><br />";
    $content .= "Name: <b>" . $your_name . "</b><br />";
    $content .= "Phone: <b>" . $your_phone . "</b><br />";
    $content .= "E-mail: <b>" . $your_email . "</b><br /><hr /><br />";
    $content .= $your_message;
    $content .= "<br /></body>";

 

Works for me

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.