473,602 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Mail Form

16 New Member
Hey all I keep trying to copy a php mail form that I found on the internet, but everytime I insert it into my HTML file it doesnt acknowledge it like it did when it was originally saved as a .php file. Do I need to add a <link thing in the head to read php or should html files read it normally?

the code I am trying to use is :

<Copyrighted code removed>

I just wanted a simple mail form on my site, but this seems to be more complicated than I thought
Nov 7 '08 #1
8 2009
Dormilich
8,658 Recognized Expert Moderator Expert
of cause you have to call this as .php file (how should your server know that the php parser is to be used). though there are some tweaks that make an apache server parse html files too.

the script could need some updates as well.... (depending on your environment) from a quick glance it seems to depend on register_global s = on (I can't see $require (line 61) defined anywhere). replace the $HTTP_...vars by the appropriate $_POST or $_SERVER vars (lines 56-58, 86, 87, 117). (see manual or your phpinfo() page)
you don't need quotation marks around variables when printing/calling (echo $var; will ba as good as echo "$var";).
$error is undefined if you have none, could give you a notice when testing undeclared variables.
if you send html mails you may need additional headers (like printed-quotable, see comments to the mail() function)

and from the html point of view: don't use table layout if you don't have tabular data, omit the <font> tag (it's deprecated), css can do this way better.

regards
Nov 7 '08 #2
blaqpig
16 New Member
thanks for the response! But can I just drop that inside a .html file? Or it doesnt work like that ?
Nov 7 '08 #3
Dormilich
8,658 Recognized Expert Moderator Expert
if you have a (standard configured) web server you can't drop it in a .html file and expect it to be working (normally it just should print all out or complain that it's not valid html)

regards

PS how it usually works (well basicly....) (this is how i would explain it in the show Die Sendung mit der Maus)

client (browser): i want "page.html"
server (to client): wait a sec, yes I have it.
(fetches the file)
server (to client): here you go.
(sends it like it is to the client)

client: i want "page.php"
server: wait a sec, yes i have it.
server (to php): give me the result of "page.php"
(php parsing the file)
php (to server): here it is
(sends result to server)
server (to client): here you go.
(sends result of php to client)
Nov 7 '08 #4
Atli
5,058 Recognized Expert Expert
Hi.

I have removed the code you posted. Please make sure you do not post code that you do not have the right to distribute. Posting such code on a public forum, like this one, may not go over to well with the people that actually own it.

If you are having a specific problem with the code, try posting just the part that is causing the problem, or a snippet that we can use to reproduce the problem.

Thank you
Moderator
Nov 8 '08 #5
Atli
5,058 Recognized Expert Expert
thanks for the response! But can I just drop that inside a .html file? Or it doesnt work like that ?
What would make you think you can simply paste PHP code into a HTML file?

PHP and HTML are two very different things, and in order to use PHP, your server must have the ability to use PHP applications. And, moreover, it must know what is to be executed as PHP code.

On most servers, PHP pages have the ".php" extension, which tells the server that the page is to be executed as PHP code. Pages that have the ".html" extension will not be treated as PHP code, but simply sent to the client as HTML.

You could try to simply rename your ".html" files, replacing the ".html" extension with ".php".
Nov 8 '08 #6
blaqpig
16 New Member
I actually don't know anything about PHP. I was just looking up simple email form on google and was using free codes. I was looking for guidance as every time I use them I cannot get them to work. Sorry I did not know you can't just paste it into the HTML file.
Nov 9 '08 #7
Markus
6,050 Recognized Expert Expert
I actually don't know anything about PHP. I was just looking up simple email form on google and was using free codes. I was looking for guidance as every time I use them I cannot get them to work. Sorry I did not know you can't just paste it into the HTML file.
Well now you do.

You can actually have .html files parse php, but that requires some modifications to the server.
Nov 9 '08 #8
Dormilich
8,658 Recognized Expert Moderator Expert
I actually don't know anything about PHP.
some tutorials on php:

http://tut.php-quake.net/en/
http://www.tizag.com/phpT/
http://www.w3schools.com/php/
Nov 9 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4218
by: pee2pee | last post by:
Hi, I have below code: <html> <head> <title>Contacting Worldpay, Please wait.......</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body text="#CCCCCC">
16
2664
by: SamMan | last post by:
May be a bit off-topic... When bots scan the web for e-mail address to use for spam, do they look at what the browser is displaying, or scan through the underlying HTML markup for e-mail addresses? At work, we have stopped displaying our webmaster e-mail on our pages and created a form that uses cgi to process and send the message. Our e-mail however, is hard coded as a variable in the form and sent to the script. Will harvesters...
6
11170
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I will include the code I originally used. I understand I should switch from CDONTS to CDO mail but after several sttempts I am finding a very hard time getting the new CDO mail to work properly. Any assistance with this would be greatly...
7
2162
by: GeorgeAtkins | last post by:
I want to create a web-based form or page that consists of a series of formatted questions and answers. The form will resemble an existing paper form. When the form is filled in, I want the user to submit the form via e-mail and have the complete form with answers sent, not just the data. That is, the recipient should be able to open the attachment and see (and print) the complete, formatted form. It seems to me that solutions simply...
3
3289
uranuskid
by: uranuskid | last post by:
Hey folks, I was going to include a contact form on my website. Well, in the first place that seemed an easy thing to do with a form that prompts a PHP file validating the input vaiables and using it's mail () function to send the mail. However, as I got more into that topic I realized that one should be really concerned about the validation part to prevent spam abuse. There are shiploads of 'mail scripts' available with each of them has...
0
7920
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8404
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.