Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-29-2006, 10:52 AM   #1 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
Question Why doesn't my script work?

My script isn't working: there are no error messages, it does the last line of the script (redirect) but doesn't do the second last line (email). Here are my scripts:

HTML FORM:
HTML Code:
<form action="contact-form.php" method="POST">
<table>
<tr>
<td>
Subject
</td>
<td>
<input type="text" name="sub">
</td>
</tr>
<tr>
<td>
Your Name
</td>
<td>
<input type="text" name="name">
</td>
</tr>
<tr>
<td>
Your E-mail
</td>
<td>
<input type="text" name="email">
</td>
</tr>
<tr>
<td valign="top">
Message
</td>
<td>
<textarea rows="6" cols="30" name="msg"></textarea>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Send!">
</td>
</tr>
</table>
</form>
PHP SCRIPT:
PHP Code:
<?php
$sub 
$_POST["sub"];
$name $_POST["name"];
$email $_POST["email"];
$msg $_POST["msg"];
mail("contact@stuff4web.co.uk",$sub,$msg,"From: $email");
header("Location: contact.php?d=1");
?>
markster is offline   Reply With Quote
Old 11-29-2006, 11:24 AM   #2 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 596
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
Does the server you are running the script on have a valid smtp server running?
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 11-29-2006, 11:30 AM   #3 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
i think it does, im gonna do some snooping
markster is offline   Reply With Quote
Old 11-29-2006, 12:32 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,446
sde is on a distinguished road
is error reporting on in your php config?
__________________
Mike
sde is offline   Reply With Quote
Old 11-30-2006, 08:05 AM   #5 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
Yep. All other php scripts (mine or on other sites) will tell me when there's an error, but this one does nothing and thats what annoy me!!!
markster is offline   Reply With Quote
Old 11-30-2006, 10:29 AM   #6 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,694
redhead is on a distinguished road
You could try:
PHP Code:
...
if(
mail("contact@stuff4web.co.uk",$sub,$msg,"From: $email"))
  
header("Location: contact.php?d=1");
else
{
  echo 
"Error sending mail, perhaps no sendmail compiled with used php installation, please wheck for it";
  
phpinfo();
}
?> 
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 11-30-2006, 10:41 AM   #7 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
It sent me back to the page, but still no E-mail.
markster is offline   Reply With Quote
Old 11-30-2006, 10:46 AM   #8 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
dont know if this is to do with anything, but here is what I got when i did the phpinfo() thingy:

sendmail_from | me@localhost.com | me@localhost.com
sendmail_path | no value | no value
markster is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script variable sde Linux / BSD / OS X 9 12-13-2005 06:59 PM
How to create a ping-tracking script..? daleo Standard C, C++ 1 11-13-2005 09:45 AM
Weird Image Scrolling Script...Please Help mark4man HTML, XML, Javascript, AJAX 3 06-14-2005 07:51 AM
Executing a server script from PHP sde PHP 4 02-05-2005 11:12 AM


All times are GMT -8. The time now is 05:14 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting