PHP mail script. where do i upload it to?

  Leslie-212488 18:19 13 Feb 2008

Hi all,
i wish to replace my mailto, link with a form.
I have looked a many of the previous posts, rplating to mailand feedback form. I have also done some research online. and i still do not know where to place the script.Everyone just says "now upload your script ".Ihave looked Java scripts, perl, and PHP. I think i havefound a PHP script that i can use, but i need some explicit instructions. PLEASE !

Thanks in advance for all your help.
And should i disable the mailto link, ASAP?

  wildtrout 14:42 14 Feb 2008

click here

This works for me and good how to install guide.

  Kemistri 16:22 14 Feb 2008

Just bung it in the same directory as the HTML file that contains the form, but make sure that it is coded such that it will bounce a visitor to an HTML page if they try to call the PHP file directly. Otherwise, they can find your e-mail address easily.

  Leslie-212488 20:11 14 Feb 2008

i thought that scripts went into a different directory.
how do i bounce a visitor to a html page?

  Kemistri 20:24 14 Feb 2008

You call the PHP file like this:

<form method="post" action="form.php">

So you want it where the browser can find it, for simplicity.

  Leslie-212488 00:05 15 Feb 2008

i have; form method= "post"
action="<? php echo $_server [script_name] ?>" >

do i have to fill in the name of the script in the square bracket?
Also the form contains alot of php syntax in the text area.what does that mean?
if i use that form do i remove the php syntax?
it seems like the script and the form are bundled together and should not be parted.
your name<br><input type="text" style="width: 330px;" name="name" value="<?php echo $_POST['name']; ?>" maxlength="50"><br><br>

  Kemistri 13:47 15 Feb 2008

You don't really want the PHP mixed in with the markup -- that can be more difficult for you to manage and leaves it easily viewable. Not having your e-mail address in the markup is crucial to keeping it hidden and it is just much better to work neatly delineated files according to type (PHP, HTML, etc.).

  Leslie-212488 21:26 17 Feb 2008

i am a bit confused,is the script called by the contact us link on a html page or, is the script called by form after it's been submitted?
if it is the former then the fields in the form will be blank, wont they?
or do i just remove the syntax and use the form to call the script.

  Kemistri 21:52 17 Feb 2008

The HTML form calls the PHP file. See the bit of markup in my second post.

  Leslie-212488 18:32 19 Feb 2008

I think i may have messed up, big time.
I uploaded the script and form to the public_html directory. The form does not look right, as the fields still contain php syntax. have a look here
click here
I went ahead and filled in the form and submitted it. It came up wiyh an error; page cannot be found. is it possible that you can have a look at the script for me and put me in the right direction?

  Kemistri 19:34 19 Feb 2008

A slip of the shift key there, I expect. You had an underscore instead of a hyphen, but I found it anyway. Looking at your source, I see a real mess. Text fields do not require values and certainly not in the form of PHP code!! If a text field has any kind of value, it will be something descriptive, such as "search" or "first name". Next up, your action is wrong; this should be the title of the PHP file, as per one of my earlier posts in which I laid out an example of that line. Then finally, there is some stray PHP at the bottom.

Obviously, there is no way for me or anyone else to view the PHP file directly, so I can't comment about that.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Galaxy Note 8 vs iPhone X

Awful clip art from 1994 is being tweeted every hour by a bot

iPhone X vs Samsung Galaxy Note 8

Les meilleurs navigateurs internet 2017