Jump to content

Simple Contact form


Larry0788

Recommended Posts

Hello, I have just finished very simple contact form at http://stjohnsclaims.co.uk/test5/index-6.html and I am strugling to redirect the page to index.html, or any other URL when buttom "submit" is pressed.  html file always reads contact.php file and then echo ("Your claim form was successfully sent!"); on blank background. How can I redirect it? I know this is very trivial question, but I have alrready spend many hours trying to fix it with no result. Thank you

 

 

html body....

 

 

<div class="indent1">

                            <h2>Claim Form</h2>

                                <form action="contact.php" method="get" id="form"><div class="container">

                                <div class="col-5"><h4>Your Details:</h4>

                                    <div class="h"><input name="name" type="text" class="input1" />Name:</div>

                                    <div class="h"><input name="surname"type="text" class="input1" />Surname:</div>

                                    <div class="h"><input name="tel"type="text" class="input1" />Tel:</div>

  <div class="h"><input name="email"type="text" class="input1" />Email Adress:</div>                                 

  <div class="h"><input name="address"type="text" class="input1" />Address:</div>                                 

                                    <div class="h"><input name="city"type="text" class="input1" />City:</div>

                                    <div class="h"><input name="postcode"type="text" class="input1" />Postcode:</div><p>

                                    <h4>Accident Details</h4>

                                      <div class="h"><input name="date"type="text" class="input1" />Date of Accident:</div>

                                    <div class="h"><input name="type"type="text" class="input1" />Accident Type:</div>

                                   

   

 

                                    </div>

 

                                <div class="col-6">Accident details/Injuries sustained:</div>

 

                                <div class="col-7">

                                    <textarea name="message" class="textarea" rows="40" cols="30"></textarea>

 

                                        <div class="container1">

                                            <div class="fright">

<a href="#" onclick="document.getElementById('form').reset()" class="link-1"><em><b>Clear</b></em></a>

                                              <div class="indent-2">

<a href="#" onclick="document.getElementById('form').submit()" class="link-1"><em><b>Submit</b></em></a></div>

                                            </div>

                                        </div>

                                    </div>

                                </div></form>

 

---------------------------------------------------------------

contact.php on the server

 

 

<?

$subject="from ".$_GET['name'];

$headers= "From: ".$_GET['email']."\n";

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

mail("kc@kamil-cizek.com", $subject,  "

<html>

<head>

<title>Contact letter</title>

</head>

<body>

 

 

 

<br>

 

 

"

. "name: " .$_GET['name']. "<br>"

. "email: " .$_GET['surname']. "<br>"

. "fax: " .$_GET['tel']. "<br>"

. "age: " .$_GET['email']. "<br>"

. "gender: " .$_GET['address']. "<br>"

. "name: " .$_GET['city']. "<br>"

. "email: " .$_GET['postcode']. "<p>"

. "fax: " .$_GET['date']. "<br>"

. "age: " .$_GET['type']. "<p>"

 

 

. "message: <p>" .$_GET['message']."

 

 

</body>

</html>" , $headers);

 

echo ("Your claim form was successfully sent!");

 

 

?>

Link to comment
Share on other sites

I have tried to put in on the same place as echo ("Your claim form was successfully sent!"); and it doesn't work.

 

Should that be like:

 

<?

$subject="from ".$_GET['name'];

$headers= "From: ".$_GET['email']."\n";

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

mail("kc@kamil-cizek.com", $subject,  "

<html>

<head>

<title>Contact letter</title>

</head>

<body>

 

 

 

<br>

 

 

"

. "name: " .$_GET['name']. "<br>"

. "email: " .$_GET['surname']. "<br>"

. "fax: " .$_GET['tel']. "<br>"

. "age: " .$_GET['email']. "<br>"

. "gender: " .$_GET['address']. "<br>"

. "name: " .$_GET['city']. "<br>"

. "email: " .$_GET['postcode']. "<p>"

. "fax: " .$_GET['date']. "<br>"

. "age: " .$_GET['type']. "<p>"

 

 

. "message: <p>" .$_GET['message']."

 

 

</body>

</html>" , $headers);

 

<meta http-equiv="refresh" content="5;url=./index.html">;

 

 

?>

Link to comment
Share on other sites

No you put html in the php code.

 

This should be exactly what you need

 

<?
$subject="from ".$_GET['name'];
$headers= "From: ".$_GET['email']."\n";
$headers.='Content-type: text/html; charset=iso-8859-1';
mail("kc@kamil-cizek.com", $subject,  "
<html>
<head>
<title>Contact letter</title>
</head>
<body>



<br>


"
. "name: " .$_GET['name']. "<br>"
. "email: " .$_GET['surname']. "<br>"
. "fax: " .$_GET['tel']. "<br>"
. "age: " .$_GET['email']. "<br>"
. "gender: " .$_GET['address']. "<br>"
. "name: " .$_GET['city']. "<br>"
. "email: " .$_GET['postcode']. "<p>"
. "fax: " .$_GET['date']. "<br>"
. "age: " .$_GET['type']. "<p>"


. "message: <p>" .$_GET['message']."


</body>
</html>" , $headers);

?>
<meta http-equiv="refresh" content="5;url=http://stjohnsclaims.co.uk/test5/index.html">;

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.