php - one step beyond!

Hi,

Some help please. I’m modified a php mail script. The original provided Name, email and message.

I want to use a modified version to provide me with name, email, company and postcode.

I’ve tweaked things in Dreamweaver but php errors on lines :-

13, - $email";
15 - $company";
and 16 - $postcoode";

You can tell I don’t do code - let alone php.

Could someone please point me down the straight and narrow. Would be good to put a line break between each answer as well please?

Many thanks,

Joe.

[php]<?php
session_start();
$name = $_GET[‘name’];
$email = $_GET[‘email’];
$postcode = $_GET[‘postcode’];
$subject = 'New entry via web form, from ’ . $name;
if(strtolower($_REQUEST[‘code’]) == strtolower($_SESSION[‘random_number’]))
{
$TO = "[email protected]";
$h = “From: " . $email;
$content = “$name ($email) sent you the following message :\n\n$name”;
$email”;
$company";
$postcoode";
mail($TO, $subject, $content, $h);
echo 1;
}
else
{
echo 0; // invalid code
}
?>[/php]

What are you hoping to accomplish with these:

13, - $email"; 15 - $company"; and 16 - $postcoode";

Hi, many thanks for your reply. This works and provides me with the data i need:-

[php]<?php
session_start();
$name = $_GET[‘name’];
$email = $_GET[‘email’];
$message = $_GET[‘message’];
$subject = 'New message via web form, from ’ . $name;
if(strtolower($_REQUEST[‘code’]) == strtolower($_SESSION[‘random_number’]))
{
$TO = "[email protected]";
$h = "From: " . $email;
$content = “$name ($email) sent you the following message :\n\n$message”;
mail($TO, $subject, $content, $h);
echo 1;
}
else
{
echo 0; // invalid code
}
?>
[/php]
I want to change the form so provide me with name, email, company and postcode. I’ve changed the code (okay I guessed) but i get error messages telling me the code in incorrect. This is the modification i made that does not work:-

[php]<?php
session_start();
$name = $_GET[‘name’];
$email = $_GET[‘email’];
$company = $_GET[‘company’];
$postcode = $_GET[‘postcode’];
$subject = 'New entry via web form, from ’ . $name;
if(strtolower($_REQUEST[‘code’]) == strtolower($_SESSION[‘random_number’]))
{
$TO = "[email protected]";
$h = “From: " . $email;
$content = “$name ($email) sent you the following message
:\n\n$name”;
$email”;
$company";
$postcoode";
mail($TO, $subject, $content, $h);
echo 1;
}
else
{
echo 0; // invalid code
}
?>
[/php]
Does this help?

Thanks.

Joe.

You aren’t answering my question. What is the purpose of those variables? Just throwing a quote after a variable doesn’t do anything other then confuse the interpreter.

Sorry i’m working on a form on a webpage (still work in progress). The form works as is from here using the get in touch link

http://www.provision-cctv.com/boot/contact.html

I want to modify the form so i get the name, email address, company and post code from this web page (enter the draw):-

http://www.provision-cctv.com/boot/samsung

Does this help? many thanks.

So you need to fix this string of variables. Maybe combine them?

[php] $content = “$name ($email) sent you the following message
:\n\n$name”;
$email";
$company";
$postcoode";[/php]

Hope i am not offending you asking the following questions:
Kind of curious what exactly do you need these data for?
Is it your website?
Did you code the original working php code?

astonecipher - many thanks for the reply - yes i would like to combine them - but, back to square one - I’m getting syntax errors in Dreamweaver.

Cluster_one - no offence taken if you follow the link you should be able to see why/what i want the data for. Yes it’s for a website. No i did not code the original - it’s from a purchased template that i’m trying to modify. Thanks Joe.

Perhaps the following might help you:

Add this statement one line before ,if (strtolower …etc), statement,
[php]$form_data = $email . $company . $postcode ;[/php]
… then change the relevant statement to:
[php]content = “$name ($email) sent you the following message
:\n\n$form_data”;[/php]

Cluster_One showed what I actually meant when I said,

Maybe combine them?

Maybe concatenation would have been a better term?

Sponsor our Newsletter | Privacy Policy | Terms of Service