Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) php blues. stumped on making a simple form

  • php blues. stumped on making a simple form

    Posted by Carl Sollenberger on February 22, 2011 at 8:34 am

    I am working on my own site and having trouble with a form I would like to implement.
    On my contact page I have made a very simple form that would allow people to type in a message, hit send, and then have that message go to my email. Well… the form looks ok but does not work at all.

    I have searched and read posts on the cow in an effort to not have to trouble anyone with a post, but am unable to resolve this problem.

    I don’t even know if the php page needs to have the same name as my form, but I suspect it might.

    I downloaded a php script that I found on google and had no luck.
    I get this error when trying to use the form on line:
    Method Not Allowed
    The requested method POST is not allowed for the URL /contact.html.

    My form is named form1 and my php page is named form1formprocess.php
    my site is westbrookadvertising.com

    Thank you very much, Carl

    Mike Smith replied 15 years, 2 months ago 4 Members · 14 Replies
  • 14 Replies
  • Mike Smith

    February 22, 2011 at 9:11 am

    You need to put the url of your php page in the form action property in your form. At present you have a blank in the quotes after action – as

    <form action=”” method=”post” name=”form1″ id=”form1″>

    <form action=”PUT THE URL OF YOUR PHP SCRIPT HERE” method=”post” name=”form1″ id=”form1″>

  • Carl Sollenberger

    February 22, 2011 at 9:46 am

    please forgive me, trying to understand.

    I know where the form action is, but I’m not sure what the correct url would be.

    My site is westbrookadvertising.com and my form is form1formprocess.php. so would the correct url be
    https://westbrookadvertising.com/form1formprocess.php.html ?
    That’s what I put in and still no luck for what it’s worth. And thank you very much for your help by the way.

    Carl

  • Mike Smith

    February 22, 2011 at 2:08 pm

    Sorry Carl

    PHP is a server-side language – it all happens at the server, not in the browser. If a file has PHP in it and the server knows that, then before the web page is served a PHP interpreter on the server looks at the script in the PHP file, and, we hope, carries out the operations asked for, passing the results to the web server to include in the page supplied to the browser.

    The usual way people let the server know what to do is to use a .php file extension = not with .html at the end.

    So in your case you could try setting as your form action
    https://westbrookadvertising.com/form1formprocess.php

    and let us know what happens ?

    All best

    In fact I’ve just tried that, and your server has supplied me the raw php file, which is not good – a security risk for you.

    OK it’s not quite that bad, security wise, though you do have some PHP issues. Someone has replaced the open-angle-brackets < signs with the html entity ‘< ” on your vital php opening tag and elsewhere, which looks the same over the web but does not work the same at the server end. I’m not sure I can offer a quick fix on this – your php page is a long way from what you need.

  • Mike Smith

    February 22, 2011 at 2:37 pm

    Using what you have, you could try replacing your php file contents with these (save your originals somewhere as a backup) and be sure that your second and fourth EOD are the first and only things on their lines – no spaces before or after. This is my guess at what your script file was meant to look like …

    <?php

    /* Email Variables */

    $emailSubject = 'contactformprocess!';
    $webMaster = 'westbroo@westbrookadvertising.com';

    /* Data Variables */

    $email = $_POST['email'];
    $name = $_POST['name'];
    $comments = $_POST['comments'];

    $body = <<<EOD

  • Carl Sollenberger

    February 22, 2011 at 6:11 pm

    wow thank you so much for all of your time. I used your code and still no luck – as well as the action script.
    I can’t thank you enough for your time, and I will keep plugging away at this. Kind of funny how complicated a simple form like this is turning out to be. I’m sure I’ve found a way to make it harder than it should be.

    Thanks again! Greatly appreciated.

  • Mike Smith

    February 22, 2011 at 7:40 pm

    Try putting a ? before the final close angle brackets so
    ?>
    Try closing the title tag line with a </title> so

    <title>sent message </title>

    Try closing the inverted commas in the http meta refresh line so

    And try closing the CLOSING style tag with a close angle bracket instead of the special & gt ; character, so
    < /style >

    there may be more little things I haven’t spotted yet. If you want the message sent message to last longer before the page returns to your contact form increase the value in the meta http refresh to say 5

    like

    <meta http-equiv="refresh" content="5;URL=https://westbrookadvertising.com/contact.html" >

  • Richard Williams

    February 22, 2011 at 8:01 pm

    Hi Carl/Mike

    Carl, i helped someone in another forum with their PHP Script, and wrote out some explainations of what we are doing and why in the code, the post is here and it might help you understand a little better hopefully and get your form working.

    Also, in the Dreamweaver forum under FAQ’s link, Abraham has a very simple form submission PHP script which again you could follow and try out then work on that…

    Hope this helps.

    Richard Williams
    p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)

  • Carl Sollenberger

    February 23, 2011 at 2:18 am

    Thanks a lot to both of you fellas for your time and help!
    My brain is turning in to mush at this point : )

    I might just take a break from this, because no matter what I try I’m having zero luck. I’m sure a lot of it if not all of it is that I’m fairly new to php and code….

    I’ve read all of your excellent posts and many others, I’m just not able to get this darn form going.

    AT this point I’ve scrapped all of my php pages because they are just getting hashed and rehashed.

    I just need a fresh start.

    A big thanks again guys.

  • Carl Sollenberger

    February 23, 2011 at 3:30 am

    Well I checked and my server handles php…. am I suposed to load some php code directly in to my server? Or is the php page in my root folder all I need.

  • Fernando Mol

    February 23, 2011 at 4:08 am

    Create a new file and name it:

    phpinfo.php

    The content of such file should be:

    <?php
    phpinfo();
    ?>

    Save and upload to your site. If you can open it then you have PHP and the file will display all the php info on your server.

    I have to add, many hosting services provide their own code for contact forms, for security reasons. Ask them.

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy