Jump to content

[PHP] Quick question


kanexpo

Recommended Posts

Hi

 

can someone please tell me why this isnt working

 

'Online Form: '.$subject, .$_SERVER['REMOTE_ADDR'], "Name: $name"), ."\n\n".$message, "From: $from");

 

It's from an Online Contact form. I had to add the "name" manually and i seem to have done something wrong.

 

thanks

Link to comment
Share on other sites

Syntax and other errors

 

<?php
'Online Form: '.$subject, .$_SERVER['REMOTE_ADDR'], "Name: $name"), ."\n\n".$message, "From: $from");
?>

 

<?php
print "Online Form: $subject, " . $_SERVER['REMOTE_ADDR'] . ", Name: $name,\n\n$message, From: $from";
?>

You also need to either print/echo the string, or store it in a variable.

 

 

edit:

wait a minute... can you post more of this code?

Link to comment
Share on other sites

hi, thanks for the reply. here is the full code

<?php


// load the variables form address bar
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$name = $_REQUEST["name"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];

// remove the backslashes that normally appears when entering " or '

$message = stripslashes($message); 
$subject = stripslashes($subject); 
$name = stripslashes($name);
$from = stripslashes($from); 

// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
mail("your@email.com", 'Online Form: '.$subject, .$_SERVER['REMOTE_ADDR'], "Name: $name"), ."\n\n".$message, "From: $from");
// delete the cookie so it cannot sent again by refreshing this page
setcookie('tntcon','');
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style></head>

<?php



include 'thanks.php';

?>

<body>
</body>
</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.