Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Contact us php form doesn’t work

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #45472
    Baerspective
    Participant

    I need help, desperately. I don’t know PHP to save my life. Dabbled in it but just don’t get it :-(.
    Anyway, I have a tiny contact us form. I made the HTML/CSS. Found the php online and modified it a tad bit, ie in my form “comment” is not a required field, since folks who contact the company do so in order to ask a question.
    When I submit the form i get error messages which were put into the php form as a function (not by me). Have no idea what to do how to correct this.
    Here is the form URL:

    http://baerspective.com/northstarfencing/contactus.html

    Try to fill out the diminutive form and see, plz.
    I wanted to make a pen, but I don’t see where to place the php, see only HTML, css, js option. Apologies

    http://codepen.io/seraphzz/pen/xwomI

    #138536
    Baerspective
    Participant

    mcjohnst, i pasted link in my first post just now. but maybe should paste it in this second one as well

    http://codepen.io/seraphzz/pen/xwomI

    sorry for delay getting back with both you and FragaGeddon and mcjohnst.
    thanks so much for helping

    #138537
    Alen
    Participant

    Spelling mistake, line 7, should be `die(“string”);` not `died();`.

    This could be your issue.

    #138538
    Baerspective
    Participant

    AlenAbdula do i need to change all died() to die()?

    #138540
    Alen
    Participant

    Yes. There is no such thing as died() in PHP.

    http://php.net/manual/en/function.die.php

    #138542
    Baerspective
    Participant

    i’ve been able to resolve my troubles with the php form

    #138551
    Baerspective
    Participant

    i got it figured out. thanks for everyones input and help

    #138543
    __
    Participant

    >is it possible that i messed things up when i removed the ! before the isset($_POST)) ?

    quite possibly. `!` means “not”, therefore `if( ! isset( $_POST ) )` means “if POST index ‘comments’ do _not_ exist.” By changing it to `if( isset( $_POST ) )`, you change the meaning to “if POST index ‘comments’ _do_ exist.” You changed it from **requiring** the field to be filled out to requiring that it **not** be filled out.

    >i did not make the comments field a required field as i figured folks would be contacting the company with questions and hence would be filling out the comment section anyway.

    I don’t follow: if you want/expect them to fill out the comment section, why do you _not_ want to make it _required_?

    #138544
    Baerspective
    Participant

    omg traq. my head is spinning. i changed php script to where ” comments” is a required field. as i figured that i had changed the script significantly enough by removing the “is not set”.
    i did not have the comment section as a required field before, as i figured folks would be automatically filling that text area out….but maybe that was just a wrong assumption.
    thanks so much for taking your time to explain it to me.
    script seems to work now after i corrected the : died() to die() as AlenAbdula pointed out, made the comment field a required field and also, just while changing things up renamed function died($error) to function error_msg() .

    again, thanks to all who took their time to help me.

    #138545
    Alen
    Participant

    @traq +1, also why even check if something exists if it’s not required… wouldn’t just passing the data be enough. If it’s there it’s there, if not well it’s not required in which case you’re left with empty string.

    Humans might not be the only ones submitting to your form.

    Plus, since the comment field provides you/company with relevant and important information make it required. Any optional fields can be !required.

    #138547
    Alen
    Participant

    @Baerspective, I’m glad everythings working.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Back End’ is closed to new topics and replies.