Jump to content

contact form


hyipcharts
 Share

Recommended Posts

Hi all, I have finished my script and installed it on my site yesterday. hyipchartsIt has three places where I receive email. None of them are working. I know the settings are all correct on the hosting side, it worked with the old script. If anyone could take a look at the code and see if there are any mistakes I am missing.It does not give me any errors. I just don't receive the emails.

[code]<?php	$PageTitle='Contact';	require_once('config/config.php');	require_once('config/func.php');		$name=stripslashes(htmlspecialchars($_POST['name']));	$mail=$_POST['mail'];	$msg=stripslashes(htmlspecialchars($_POST['msg']));		if ($_POST['go']==1)		{		if(!empty($mail) && !empty($name) && !empty($msg))			{			if ($_SESSION['uniqCode']==$_POST['ui'])				{				session_unregister('uniqCode');				if(preg_match("/.+@.+\..+/", $mail))					{					$message="Name: $name							E-mail: $mail							Message: $msg";					if(mail(AdminMail, 'Message from feedback form', $message, "FROM: ". PageTitle ."<>"))						{						mail($mail, 'Thanks for sending message', 'Thanks for sending message to the administrator of '. PageTitle, "FROM: ". PageTitle ."<>");						unset($name, $mail, $msg, $_POST['go']);						$added=true;						}					else						$error='Error occured when trying to send your message to administrator.';					}				else					$error='Incorrect e-mail address!';				}			else				$error='Thanks for sending message';			}		else			$error='Fill all fields!';		}		require('config/begin.php');?>				<table width="600" border="0" align="center">	<tr>		<td>			<h1>Contact</h1>		</td>	</tr>	<tr>		<td>			<?php			$t=explode(' ', microtime());			$uniqCode=uniqid($t[1]);			session_register('uniqCode');						if(strlen($error))				error($error);			elseif($added===true)				echo('<div class="msg">Message was sent to administrator. Thank you.</div>');			?>			<form method="post" style="margin: 0px">			<input type="hidden" name="go" value="1">			<input type="hidden" name="ui" value="<?php echo $uniqCode ?>">			<table width="400" align="center" border="0">				<tr>					<td width="60">Name:</td><td width="340"><input type="text" size="20" maxlength="20" name="name" value="<?php echo $name ?>"></td>				</tr>				<tr>					<td>E-mail:</td><td><input type="text" size="20" maxlength="32" name="mail" value="<?php echo $mail ?>"></td>				</tr>				<tr>					<td valign="top">Message:</td><td><textarea cols="40" rows="8" name="msg"><?php echo $msg ?></textarea></td>				</tr>				<tr>					<td colspan="2" align="center">						<input type="reset" value=" RESET ">  						<input type="button" value=" SUBMIT " onClick="this.form.submit();this.disabled=true">					</td>				</tr>			</table>			</form>		</td>	</tr></table><?php	require('config/end.php');?>[/code]

If my config file it calls the email address.Thanks in advance

Link to comment
Share on other sites

You wouldn't need an action (it's not wrong to add it), as without an action the formdata is sent to the same page when submitted, which is how the script should be used..I can't find any problem with your code. And the only question that raises is what the value of the "constant" AdminMail is, and if it's valid.Good Luck and Don't Panic!

Link to comment
Share on other sites

Thanks for the feed back. I also cannot find an error in the code. My config/config file has the usual database info.<?phpdefine('dbHOST', 'localhost');define('dbNAME', 'dbname);define('dbUSER', 'user);define('dbPASS', 'password');define('PageAddress', 'www.hyipcharts.com');define('PageTitle', 'HYIPCHARTS - Charting the world of HYIPS');define('AdminMail', 'admin@hyipcharts.com');@mysql_connect(dbHOST, dbUSER, dbPASS) or die('<div class="error">Cannot connect to database!</div>');@mysql_select_db(dbNAME) or die('No database!');If I only had the contact form I would rewrite it. However, I have a vote and lost password function which relies on email. I have tried all of them and nothing works. I get no errors, but receive no mail.I am at a complete loss. If anyone wants more info please let me know. It is very important that this work.Thanks

Link to comment
Share on other sites

Just try this script on your server & check that you are getting the mail or not.If might it give the Result that 'Mail Sent Successfully' & u don't get the mail. Then U have to Go for SMTP Script.This means u'r PHP has send the Mail but there is some problem with SMTP Server.Just check the Settings in php.ini. May be it useful to you.<?$status = mail('admin@hyipcharts.com', 'test', 'test');if($status) echo "Mail sent successfully";else echo "Error in Mail sending";?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...