Forums

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

Home Forums Back End Contact Post not displaying information

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 47 total)
  • Author
    Posts
  • #42813
    WindberTSA
    Member

    Hey guys,

    I created a contact form on the website I have. (http://windbertsa.com/contact.html) I do receive comments from this post(I think spam because its the same time everyday). But, the emails only display “Name: Email: Comments:” They do not show anything else.

    I have a php file that looks like this:

    /* Email Variables */
    $emailSubject = ‘Windber-tsa!’; /*Make sure this matches the name of your file*/
    $webMaster = ‘***’;

    /*design by Mark Leroy @ http://www.helpvid.net*/

    /* Data Variables */
    $email = $_POST;
    $name = $_POST;
    $comments = $_POST;

    $body = <<

    Name: $name

    Email: $email

    Comments: $comments

    EOD;
    $headers = “From: $emailrn”;
    $headers .= “Content-type: text/htmlrn”;
    $success = mail($webMaster, $emailSubject, $body,
    $headers);

    /* Results rendered as HTML */
    $theResults = <<

    sent message

    Your message has been sent successfully! Thank You for your message, We will respond promptly.


    EOD;
    echo “$theResults”;
    ?>

    And the form itself looks like this..


    Clear      Send

    I just do not understand why I do not get other information with these messages. Any help would be greatly appreciated!

    #125019
    __
    Participant

    You’re trying to access POST indexes that don’t exist (and, you never check to see if they exist or not).

    $email = $_POST;
    $name = $_POST;
    $comments = $_POST;

    Whereas your form has the inputs `Your Name`, `E-mail`, and an unnamed textarea.

    Give the textarea a name, and check when assigning your variables:

    ‘no email provided’:
    $_POST;

    // etc.

    #125077
    WindberTSA
    Member

    First of all, Thanks!

    Where you have ‘$email = empty( $_POST )?’

    Should that value, e-mail, match the name of its respectable form element?

    #125079
    tomrogers123
    Member

    @WindberTSA Yes, the string parsed into a global should match the `name` attribute of the input in question. Just another note, the `name` and `id` on an `input` element should be exactly the same and match the `for` attribute on the `label` so that, when a user clicks a label, the cursor is placed in the corresponding field.

    #125081
    WindberTSA
    Member

    @tomrogers123 So it should look like this?


    Clear      Send

    #125083
    tomrogers123
    Member

    Yes, apart from the fact that the inputs shouldn’t be __inside__ the labels.





    #125085
    WindberTSA
    Member

    I’m not very good with forms or PHP. What does moving those labels and inputs do?

    #125086
    WindberTSA
    Member

    Oh! That changed the way my form is displayed.. http://windbertsa.com/contact.html

    It also changed the way the comment ‘box’ enlarges. Before the image for that box would move with the input area enlarging, now it doesn’t enlarge..

    #125092
    tomrogers123
    Member

    I know you probably don’t want the labels to be shown but they need to be in the markup for accessability reasons. You could remove them from display with;

    #contacts-form label {
    position: absolute;
    top: -99999px;
    left: -99999px;
    }

    As for getting the hint text inside the fields themselves, that’s what the HTML5 `placeholder` attribute is intended for.

    #125095
    WindberTSA
    Member

    Okay, So I applied that style that you recommended but now the blue input boxes I had set are only showing for the comment not for the name or email field.

    #125096
    WindberTSA
    Member

    On another note, The form itself is not sending any emails now..

    #125099
    tomrogers123
    Member

    Sorry about that, any chance of an updated demo so I can see the latest issue?

    #125102
    WindberTSA
    Member

    Yeah, I uploaded the changes.. http://windbertsa.com/contact.html

    #125110
    tomrogers123
    Member

    Due to the fact that you had the inputs inside of labels before, you’re actually styling labels with styles that should be moved to inputs.As for the functionality, when did it stop working? Was it when you changed the PHP? If so, you need to make sure the `method` attribute on your form matches whatever you are using in PHP. If you have copied the code @traq suggested, you will need to change the `method` attribute in the markup to post so that they match.

    #125114
    WindberTSA
    Member

    So, everywhere in the CSS styling that i have ‘label’ I need to have input? This form thing is very confusing to me.. thanks again for your help!

    This is all the styling that I have applied to the form, or I guess previously applied..

    #contacts-form label { display:block; height:40px; background:url(../images/input.gif) no-repeat left top;}
    #contacts-form label input { width:260px; padding:4px 4px 2px 5px; color:#0f181e; border:none; background:none;}
    #contacts-form textarea {width:260px; height:102px; padding:2px 4px 2px 5px; color:#0f181e; overflow:auto; background:none; border:none;}
    #contacts-form .textarea { background:url(../images/textarea.gif) no-repeat left top; width:270px; height:107px; margin-bottom:30px;}
    #contacts-form label { position: absolute; top: -99999px; left: -99999px; }

    Well, the form never worked correctly to begin with, but it did send me messages without information. And This is what I have after changed what @traq suggested..

    /* Email Variables */
    $emailSubject = ‘Windber-tsa!’; /*Make sure this matches the name of your file*/
    $webMaster = ‘[email protected]’;

    /* Data Variables */

    $email = empty ( $_POST )?
    ‘no email provided’:
    $_POST;

    $name = empty ( $_POST )?
    ‘no email provided’:
    $_POST;

    $comments = empty ( $_POST )?
    ‘no email provided’:
    $_POST;

    $body = <<

    Name: $name

    Email: $email

    Comments: $comments

    EOD;
    $headers = “From: $emailrn”;
    $headers .= “Content-type: text/htmlrn”;
    $success = mail($webMaster, $emailSubject, $body,
    $headers);

    /* Results rendered as HTML */
    $theResults = <<

    sent message

    Your message has been sent successfully! Thank You for your message, We will respond promptly.


    EOD;
    echo “$theResults”;
    ?>

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