Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
URGENT! - Contact form not working
Old 03-08-2008, 08:22 PM URGENT! - Contact form not working
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Sorry, this is urgent.

My contact form is not working, it keeps display my html code even though all the fields are filled in.

index.php

PHP Code:
<?php include ('/home/a5839198/public_html/inc/config.php'); ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SGilligan :: Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/style.css">

</head>

<body><div id="main">

<div class="logo">
<?php echo $tagline ?>
</div>

<?php echo $nav ?>

<div class="content"><div class="box"><div class="title style1">Contact</div>
<p style="color:red; ">All fields required</p>
<form method="post" action="sendmail.php">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi 
getenv("REMOTE_ADDR");
$httprefi getenv ("HTTP_REFERER");
$httpagenti getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" >
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" >
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" >


Full Name:&nbsp;
<input type="text" name="visitor" size="35" >
<br ><br>
Your Email:&nbsp;
<input type="text" name="visitormail" size="35" >
<br ><br>
Subject:&nbsp;
<select name="attn" size="1">
<option selected>- - Select - -</option>
<option value=" New Project ">New Project</option>
<option value=" Technical Support ">Technical Support</option>
<option value=" General Query ">General Query</option>
</select>
<br ><br >
Message:
<br >
<textarea name="notes" rows="4" cols="40"></textarea>
<br >
<input type="submit" value="Send Mail" >

</form>
</div><div class="box2"><div class="title style1">Did You Know?</div>
<div class="iBox">This contact form was made by basic PHP, which is one of my coding skills. <a href="../about">See more...</a></div>
</div></div>

</div><?php echo $footer ?></body>
</html>
sendmail.php
PHP Code:
<?php include ('/home/a5839198/public_html/inc/config.php'); ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>SGilligan :: Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../css/style.css">

</head>

<body><div id="main">

<div class="logo">
<?php echo $tagline ?>
</div>

<?php echo $nav ?>

<div class="content"><div class="box"><div class="title style1">Contact</div>

<?php

$ip 
$_POST['ip'];
$httpref $_POST['httpref'];
$httpagent $_POST['httpagent'];
$visitor $_POST['visitor'];
$visitormail $_POST['visitormail'];
$notes $_POST['notes'];
$attn $_POST['attn'];


if (
eregi('http:'$notes)) {
die (
"Do NOT try that! ! ");
}
if(!
$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo 
"<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput "<h2>Feedback was NOT submitted</h2>\n";
echo 
$badinput;
die (
"Go back! ! ");
}

if(empty(
$visitor) || empty($visitormail) || empty($notes) || $attn='- - Select - -') {
echo 
'<p class="error">Please fill in all fields</p>';
die (
'<form method="post" action="sendmail.php">

<input type="hidden" name="ip" value="<?php echo $ipi ?>" >
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" >
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" >


Full Name:&nbsp;
<input type="text" name="visitor" size="35" >
<br ><br>
Your Email:&nbsp;
<input type="text" name="visitormail" size="35" >
<br ><br>
Subject:&nbsp;
<select name="attn" size="1">
<option selected>- - Select - -</option>
<option value=" New Project ">New Project</option>
<option value=" Technical Support ">Technical Support</option>
<option value=" General Query ">General Query</option>
</select>
<br ><br >
Message:
<br >
<textarea name="notes" rows="4" cols="40"></textarea>
<br >
<input type="submit" value="Send Mail" >

</form></div><div class="box2"><div class="title style1">Did You Know?</div>
<div class="iBox">This contact form was made by basic PHP, which is one of my coding skills. <a href="../about">See more...</a></div></div></div>

</div></body></html>'
);
}

date_default_timezone_set('GMT');

$todayis date("l, F j, Y, G:i a") ;

$attn $attn ;
$subject $attn;

$notes stripcslashes($notes);

$message $todayis \n
Attention: 
$attn \n
Message: 
$notes \n
From: 
$visitor ($visitormail)\n
Additional Info : IP = 
$ip \n
Browser Info: 
$httpagent \n
Referral : 
$httpref \n
"
;

$from "From: $visitormail\r\n";


mail("info@sgilligan.co.uk"$subject$message$from);

?>

<p align="center">
Thank You <?php echo $visitor ?>,<br><br>Your email has been sent. 

</p>
</div><div class="box2"><div class="title style1">Did You Know?</div>
<div class="iBox">This contact form was made by basic PHP, which is one of my coding skills. <a href="../about">See more...</a></div></div></div>

</div></body>
</body>
</html>
Why won't this work?
Gilligan is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-08-2008, 08:34 PM Re: URGENT! - Contact form not working
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Sorry im a little confused what u mean it shos your code?

can is see it live?
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 03-09-2008, 06:41 AM Re: URGENT! - Contact form not working
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
It just shows 'Fill in all fields'

http://www.sgilligan.co.uk/contact
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 03-09-2008, 08:05 AM Re: URGENT! - Contact form not working
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
im looking at it now... i have given up on your server, host seems to time out 4 out of 5 attempts and its very slow when it does work - get on the phone to your host and give them an ear-bashing

anyway im running locally, I will tell you what i find..
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 03-09-2008, 08:09 AM Re: URGENT! - Contact form not working
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Found it.

Your problem is here:
PHP Code:
|| $attn='- - Select - -' 
you need == NOT = because this is ASSIGNING - - select - - to that variable and will ALWAYS return true causeing it to show the message.</SPAN>

Just change to double == and it should work.

Talkupation apprieciated

Dan
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 03-09-2008, 08:11 AM Re: URGENT! - Contact form not working
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
OK spotted it!...

PHP Code:
if(empty($visitor) || empty($visitormail) || empty($notes) || $attn='- - Select - -'
In that statement you assign the variable $attn a value rather than checking it.... in PHP if you want to do equals then use == not =

So change that to ..

PHP Code:
if(empty($visitor) || empty($visitormail) || empty($notes) || $attn=='- - Select - -'
and it works perfectly.. I have tested it too.

Hope that helps
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 03-09-2008, 08:11 AM Re: URGENT! - Contact form not working
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
oh dan.. a matter of seconds in front.. you post-sniped me good =]
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 03-09-2008, 08:12 AM Re: URGENT! - Contact form not working
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
*does a little dance*

Pure luck
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 03-09-2008, 08:18 AM Re: URGENT! - Contact form not working
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Just to say Gilligan i LOVE the idea you have done on the portfollio page with the coding skills thing
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 03-09-2008, 08:25 AM Re: URGENT! - Contact form not working
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Thanks alot! i knew this thing wasn't working for something simple

and thanks for the nice comment about my page
Gilligan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to URGENT! - Contact form not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.53630 seconds with 12 queries