Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help setting up a form?

Status
Not open for further replies.

lexus37

IS-IT--Management
Jul 25, 2006
27
US
I am using dreamweaver 8 and have setup a simple form with name, phone number, email, and comments. I would like to have the information on this form emailed to me.

I found a simple form script and saved it as config.php, but it does not email me the information. I have the action as config.php, method as post, enctype as multipart/form-data. It sends me to the confirmation page, but I do not get a email. Is there another way to get this to work or if you know a better script to use.

The site is under free consultation.

Any help would be great!

here is the script I am using

<?php

// Simple Form Script
// Copyright (C) 2005 Eric Zhang
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please send bugs/questions to erkzh@yahoo.com.

//--------------------------Set these paramaters--------------------------


$subject = 'Form Submission'; // Subject of email sent to you.
$emailadd = 'allen@langbert.com'; // Your email address. This is where the form information will be sent.
$url = 'confirmation.html'; // Where to redirect after form is processed.
$req = '1'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
 
Before we can help, we need to know several things:

1. What Os are you running PHP on? Windows? Unix?

2. IS your SMTP server configured properly, in your PHP.ini file.

3. Is PHP running properly on your webserver.

-----------

Just for debugging purposes, remove the line:
Code:
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';

And tell us if it produces an error or warning.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Sorry I am all new this, but:

1. I think I am running php on windows

2. Don't even think I have the php.ini file

3. I removed the:
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';

and it does not give me a error record. Just stops at
I ran a test but all this information does not make sense to me.

PHP Version 4.3.11

System Windows NT WINHOSTECN102 5.2 build 3790
Build Date Mar 30 2005 17:32:35
Server API ISAPI
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINDOWS\php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
Debug Build no
Thread Safety enabled
Registered PHP Streams php, http, ftp, compress.zlib

This program makes use of the Zend Scripting Language Engine:
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies


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

PHP Credits

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

Configuration
PHP Core
Directive Local Value Master Value
allow_call_time_pass_reference Off Off
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions getmyinode, getopt, getrusage, extension_loaded, dl, mysql_pconnect, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, pfsockopen, mysql_list_dbs, mysql_stat, ini_get, ini_get_all, ini_alter, ini_set, get_current_user, get_defined_constants, get_include_path, php_ini_scanned_files, php_uname, phpcredits, restore_include_path, set_include_path, set_time_limit, version_compare, zend_version, getmypid, getmyuid, getmygid, assert_options, assert, fopen, fwrite, fread, file, fpassthru, file, mail, opendir, readdir, closedir getmyinode, getopt, getrusage, extension_loaded, dl, mysql_pconnect, crack_check, crack_closedict, crack_getlastmessage, crack_opendict, fsockopen, pfsockopen, mysql_list_dbs, mysql_stat, ini_get, ini_get_all, ini_alter, ini_set, get_current_user, get_defined_constants, get_include_path, php_ini_scanned_files, php_uname, phpcredits, restore_include_path, set_include_path, set_time_limit, version_compare, zend_version, getmypid, getmyuid, getmygid, assert_options, assert, fopen, fwrite, fread, file, fpassthru, file, mail, opendir, readdir, closedir
display_errors Off Off
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2047 2047
expose_php On On
extension_dir ./ ./
file_uploads On On
gpc_order GPC GPC
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .;c:\php4\pear .;c:\php4\pear
log_errors On On
log_errors_max_len 1024 1024
magic_quotes_gpc Off Off
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
max_execution_time 30 30
max_input_time 60 60
open_basedir no value no value
output_buffering 4096 4096
output_handler no value no value
post_max_size 8M 8M
precision 14 14
register_argc_argv Off Off
register_globals Off Off
report_memleaks On On
safe_mode On On
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path no value no value
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 2M 2M
upload_tmp_dir no value no value
user_dir no value no value
variables_order GPCS GPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On


ISAPI
Server Variable Value
CONTENT_LENGTH 0
PATH_TRANSLATED d:\hosting\allenle\test.php
REMOTE_ADDR 66.64.40.122
REMOTE_HOST 66.64.40.122
REQUEST_METHOD GET
SERVER_NAME 214divorce.com
SERVER_PORT 80
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/6.0
APPL_MD_PATH /LM/W3SVC/1200/ROOT
APPL_PHYSICAL_PATH d:\hosting\allenle\
INSTANCE_ID 1200
INSTANCE_META_PATH /LM/W3SVC/1200
URL /test.php
ALL_HTTP HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:__utma=166496509.1117760741.1153865012.1153865012.1153865012.1; __utmb=166496509; __utmc=166496509; __utmz=166496509.1153865012.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP_HOST:214divorce.com HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) HTTP_UA_CPU:x86
HTTPS off
SCRIPT_NAME /test.php
SERVER_PORT_SECURE 0


bcmath
BCMath support enabled


calendar
Calendar support enabled


com
Directive Local Value Master Value
com.allow_dcom Off Off
com.autoregister_casesensitive On On
com.autoregister_typelib Off Off
com.autoregister_verbose Off Off
com.typelib_file no value no value


ctype
ctype functions enabled


domxml
DOM/XML enabled
DOM/XML API Version 20020815
libxml Version 20611
HTML Support enabled
XPath Support enabled
XPointer Support enabled
DOM/XSLT enabled
libxslt Version 1.1.7
libxslt compiled against libxml Version 2.6.11


ftp
FTP support enabled


gd
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled


gettext
GetText Support enabled


ming
Ming SWF output library enabled
Version 0.2a


mysql
MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout 60 60
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off


odbc
ODBC Support enabled
Active Persistent Links 0
Active Links 0
ODBC library Win32

Directive Local Value Master Value
odbc.allow_persistent On On
odbc.check_persistent On On
odbc.default_db no value no value
odbc.default_pw no value no value
odbc.default_user no value no value
odbc.defaultbinmode return as is return as is
odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes
odbc.max_links Unlimited Unlimited
odbc.max_persistent Unlimited Unlimited


overload
User-Space Object Overloading Support enabled


pcre
PCRE (Perl Compatible Regular Expressions) Support enabled
PCRE Library Version 4.5 01-December-2003


session
Session Support enabled
Registered save handlers files user

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path no value no value
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off


standard
Regex Library Bundled library enabled
Dynamic Library Support enabled
Internal Sendmail Support for Windows enabled

Directive Local Value Master Value
assert.active 1 1
assert.bail 0 0
assert.callback no value no value
assert.quiet_eval 0 0
assert.warning 1 1
auto_detect_line_endings 0 0
default_socket_timeout 60 60
safe_mode_allowed_env_vars PHP_ PHP_
safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH
url_rewriter.tags a=href,area=href,frame=src,input=src,form=fakeentry a=href,area=href,frame=src,input=src,form=fakeentry
user_agent no value no value


tokenizer
Tokenizer Support enabled


wddx
WDDX Support enabled
WDDX Session Serializer enabled


xml
XML Support active
XML Namespace Support active
EXPAT Version 1.95.6


xmlrpc
core library version xmlrpc-epi v. 0.51
php extension version 0.51
author Dan Libby
homepage open sourced by Epinions.com


xslt
XSLT support enabled
Backend Sablotron
Sablotron Version 1.0


zlib
ZLib Support enabled
Compiled Version 1.1.4
Linked Version 1.1.4

Directive Local Value Master Value
zlib.output_compression Off Off
zlib.output_compression_level -1 -1
zlib.output_handler no value no value


Additional Modules
Module Name


Environment
Variable Value
ALLUSERSPROFILE C:\Documents and Settings\All Users
ClusterLog C:\WINDOWS\Cluster\cluster.log
CommonProgramFiles C:\Program Files\Common Files
COMPUTERNAME WINHOSTECN102
ComSpec C:\WINDOWS\system32\cmd.exe
dcdistro w3esp1
dcimgdate Mon 04/10/2006
dcimgeddate Mon 04/24/2006
dcimgedtime 23:10:04.12
dcimgtime 3:59:07.04
dcver 1.0
FP_NO_HOST_CHECK NO
NUMBER_OF_PROCESSORS 4
OS Windows_NT
Path C:\Program Files\VERITAS\NetBackup\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE x86
PROCESSOR_IDENTIFIER x86 Family 15 Model 4 Stepping 3, GenuineIntel
PROCESSOR_LEVEL 15
PROCESSOR_REVISION 0403
ProgramFiles C:\Program Files
SystemDrive C:
SystemRoot C:\WINDOWS
TEMP d:\temp
TMP d:\temp
USERPROFILE C:\Documents and Settings\Default User
windir C:\WINDOWS


PHP Variables
Variable Value
_REQUEST["__utma"] 166496509.1117760741.1153865012.1153865012.1153865012.1
_REQUEST["__utmb"] 166496509
_REQUEST["__utmc"] 166496509
_REQUEST["__utmz"] 166496509.1153865012.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
_COOKIE["__utma"] 166496509.1117760741.1153865012.1153865012.1153865012.1
_COOKIE["__utmb"] 166496509
_COOKIE["__utmc"] 166496509
_COOKIE["__utmz"] 166496509.1153865012.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
_SERVER["ALL_HTTP"] HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:__utma=166496509.1117760741.1153865012.1153865012.1153865012.1; __utmb=166496509; __utmc=166496509; __utmz=166496509.1153865012.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) HTTP_HOST:214divorce.com HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727) HTTP_UA_CPU:x86
_SERVER["HTTPS"] off
_SERVER["SCRIPT_NAME"] /test.php
_SERVER["HTTP_COOKIE"] __utma=166496509.1117760741.1153865012.1153865012.1153865012.1; __utmb=166496509; __utmc=166496509; __utmz=166496509.1153865012.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
_SERVER["AUTH_PASSWORD"] no value
_SERVER["AUTH_TYPE"] no value
_SERVER["AUTH_USER"] no value
_SERVER["CONTENT_LENGTH"] 0
_SERVER["CONTENT_TYPE"] no value
_SERVER["PATH_TRANSLATED"] d:\hosting\allenle
_SERVER["QUERY_STRING"] no value
_SERVER["REMOTE_ADDR"] 66.64.40.122
_SERVER["REMOTE_HOST"] 66.64.40.122
_SERVER["REMOTE_USER"] no value
_SERVER["REQUEST_METHOD"] GET
_SERVER["SERVER_NAME"] 214divorce.com
_SERVER["SERVER_PORT"] 80
_SERVER["SERVER_PROTOCOL"] HTTP/1.1
_SERVER["SERVER_SOFTWARE"] Microsoft-IIS/6.0
_SERVER["APPL_MD_PATH"] /LM/W3SVC/1200/ROOT
_SERVER["APPL_PHYSICAL_PATH"] d:\hosting\allenle\
_SERVER["INSTANCE_ID"] 1200
_SERVER["INSTANCE_META_PATH"] /LM/W3SVC/1200
_SERVER["LOGON_USER"] no value
_SERVER["REQUEST_URI"] /test.php
_SERVER["URL"] /test.php
_SERVER["SCRIPT_FILENAME"] d:\hosting\allenle\test.php
_SERVER["ORIG_PATH_INFO"] /test.php
_SERVER["PATH_INFO"] no value
_SERVER["ORIG_PATH_TRANSLATED"] d:\hosting\allenle\test.php
_SERVER["DOCUMENT_ROOT"] d:\hosting\allenle
_SERVER["PHP_SELF"] /test.php
_SERVER["HTTP_CONNECTION"] Keep-Alive
_SERVER["HTTP_ACCEPT"] image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
_SERVER["HTTP_ACCEPT_ENCODING"] gzip, deflate
_SERVER["HTTP_ACCEPT_LANGUAGE"] en-us
_SERVER["HTTP_HOST"] 214divorce.com
_SERVER["HTTP_USER_AGENT"] Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
_SERVER["HTTP_UA_CPU"] x86


PHP License
This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.
 
Every PHP installation has a php.ini file, according to your info, yours is located here:
lexus37 said:
Configuration File (php.ini) Path C:\WINDOWS\php.ini
Second: the SMTP server (PHP needs this to be correctly set up, to be able to send email using mail) is not configured at all:
lexus37 said:
SMTP [red]localhost localhost [/red]

Unless you have a email server running on your machine which I doubt mail() is not going to work with that configuraton. You need to configre the smtp directive to something other than localhost.

For example: If you retrieve / send your email in Outlook or Outlok express via a server, you would need to put that in the SMTP directive of the PHP.ini file.

Thirdly: I'm surprised you are not getting an error maybe something similar to:

Code:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in config.php on line 25

For starters go into yur PHP.ini file and replace localhost with whatever mail server you use.

Thne try to send the email again.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
[mail function]
; For Win32 only.
SMTP = smtpout.secureserver.net
smtp_port = 25

I changed it to that, but still does not work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top