Hello,
I am new to PHP code and I have copied the following code from the internet to create a contact page on my web site. - <?
-
$subject="from ".$_GET['your_name'];
-
$headers= "From: ".$_GET['your_email']."\n";
-
$headers='Content-type: text/html; charset=iso-8859-1';
-
mail("<emailremoved>", $subject,"
-
<html>
-
<head>
-
<title>Contact letter</title>
-
</head>
-
<body>
-
-
<br>
-
".$_GET['message']."
-
</body>
-
</html>" , $headers);
-
echo ("Your message was successfully sent";
-
?>
-
<script>
-
resizeTo(300, 300)
-
//window.close()
-
</script>
-
-
-
-
-
-
-
-
However when the script is run I get the following error
-
-
".$_GET['message']." " , $headers); echo ("Your message was successfully sent!"); ?>
-
Can any one help please?
11 1893
Sure, we'd love to help, but in order for that to happen you've got to do a few things: - Use [code] tags when supplying code
- Provide us with *all* relevant information - the info you gave is next to nothing, and certainly not enough to help you with
- Tell us the errors
- Tell us what didn't happen
- Tell us what you wanted to happen
- Tell us what *did* happen
Also, do not post email addresses.
Please read the Posting Guidelines to avoid these errors and others.
Moderator.
Sorry
The error message is at the end of the code, On my email form I input a name, email address and text. Then I press the submit button and get a window opening 300X 300 with the text listed at the end of the code. No email is sent. I am testing the code on a laptop using XAMPP. The variable name and email address are listed at the top of the window so they look to be set OK . The prblem looks to be with the email comand .......?
Thanks
see
echo ("Your message was successfully sent";
is not closed...
Thanks for the response,
I have changed the line echo ("your message was successfully sent!");
However I get the same problem but your point about closing () would the line
mail("XXX@XXXXX", $subject," need to be changed / closed
Thanks
Is this a .php file ?
Is your server running PHP?
If you view of the source code of the page, what is the output?
Thanks for the response,
I have changed the line echo ("your message was successfully sent!");
However I get the same problem but your point about closing () would the line
mail("XXX@XXXXX", $subject," need to be changed / closed
Thanks
Looking through the code I can see that the line you mention is actually closed further down with the code:
(something similar, I can't see it while I type this). Basically this code is trying to set up an HTML email message and send it using the normal mail functions in PHP.
I would either, ditch the HTML part and have a simple text only email, or read up on headers to make sure they are correct. ( Google PHP mail ) the top result should help)
Either way I would build up the message in a separate variable first and then include that variable as the message parameter.
Cheers
nathj
change
echo ("Your message was successfully sent";
to
echo ("Your message was successfully sent");
this may solve your problem. If it does not solve your problem let me know again.
Please check ur server which it allow short tag function <? and ?>
else u need to put <?php ?>
Try with this
Start php lie
<?php
<!-- ur codes -->
?>
Please check ur server which it allow short tag function <? and ?>
else u need to put <?php ?>
Try with this
Start php lie
<?php
<!-- ur codes -->
?>
The simple solution on this one is to always use the full tag <?php ... ?> and not the short tags, no need to check the server, just do it.
nathj
If you are new to PHP then you should read the PHP tutorial first. There is no point in just downloading some code and trying to automagically turn it into working code without understanding the language.
If you are new to PHP then you should read the PHP tutorial first. There is no point in just downloading some code and trying to automagically turn it into working code without understanding the language.
That's the best advice you've been given so far.
Here's the tutorial that got me started: W3Schools PHP tutorial the other site that will prove invaluable is this one.
Cheers
nathj
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jeff Dunnett |
last post by:
Hello,
I have written the following HTML Form:
<html><head><title>Survey</title></head>
<body bgcolor="black" text="white" link="#f6b580" vlink="#c0c0ff">
<img src="logo.gif" width="324"...
|
by: Steve Horrillo |
last post by:
I can't figure out why this script won't insert the subject in the email and
why can't I control the font and size being used? I'm not sure where to post
this. Let me know where if this is OT.
...
|
by: Neil McDermott |
last post by:
Hello,
I hope someone can help.
I use a php form to process contact forms on my web sites. Recently I have
been receiving lots of strange data coming through the contact forms like
this :
...
|
by: shapper |
last post by:
Hello,
I have a contact form in my web site which is working just fine on my
computer!
When I uploaded my web site to my hosting server I get an error when I
SUBMIT my form, i.e., when I...
|
by: mcchristie |
last post by:
hi all,
i've never used ASP before, but am proficient with html / css
all i want to do is add a feedback form to a site. i have the form all set up as follows:
<form method="post"...
|
by: Pete Marsh |
last post by:
Wondering if anyone can see an error with this script. I get a server
configuration error. THat could mean a module is not being loaded, but
maybe there's a syntax error here, can anyone spot it?...
|
by: kgrenier12 |
last post by:
I'm new at using php.
I am creating a basic html "contact us" form using php to send the data securely via email.
I posted the form and the screen turns blank when I hit the "submit" button.
...
|
by: Twayne |
last post by:
Hi,
I can't get the following code snippet to stop throwing errors except to
modify it exactly as shown here by adding the single quote to the end of
the first line and commenting out all but...
|
by: swethak |
last post by:
hi ,
i write the code in .htm file. It is in cgi-bin/searches/one.htm.In that i write a form submitting and validations.But validations are not worked in that .htm file. I used the same code in my...
|
by: Ecot |
last post by:
Hi all,
I have not got any php knowledge and I have found a php code on the net and using it to send e-mail from a web html form.So far the form and the code works fine.
I have the following php...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |