1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP question

Discussion in 'Web Design & Development' started by jamesb2, Feb 27, 2015.

Thread Status:
Not open for further replies.
  1. jamesb2

    jamesb2 Thread Starter

    Joined:
    Dec 8, 2007
    Messages:
    124
    I am creating a form in expression web 4. Everything appears to be working correctly when I click submit on the form. All of the fields are filled out and the php script I have does send it to an email address. My question is the following; when I fill out all of the fields in the form, not all of the fields show up. It appears I can only get past 2 fields being filled out before it starts sending blank forms. see the code below.

    $msg =$_POST['WSD-Name'];
    $msg2=$_POST['WSD-Phone'];
    $msg3=$_POST['WSD-Email'];
    $msg4=$_POST['WSD-Address'];
    $msg5=$_POST['WSD-City'];
    $msg6=$_POST['WSD-ZIP'];
    $msg7=$_POST['WSD-DOB'];
    $msg8=$_POST['WSD-Fitness-Level'];
    $to='[email protected];
    $subject='Wsd application';

    mail($to,$subject,$msg8,$msg7,$msg6,$msg5,$msg4,$msg3,$msg2,$msg);
     
  2. JiminSA

    JiminSA

    Joined:
    Dec 15, 2011
    Messages:
    3,386
    First Name:
    Jim
    Could you show us the form's html please ...
     
  3. Ent

    Ent Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,467
    First Name:
    Josiah
    I'm surprised it's doing anything at all.
    Mail doesn't take an arbitrary number of parameters. It takes between 3 and 5.
    What you probably want to do is create a single string variable with all the chunks of the message concatenated together, and then call mail($to, $subject, $wholeMessage);


    Aside, but important.
    Do not use this script on a live website. The reason is that you should never trust the input that your user gives you. Instead you should run validation code to make sure that it is the kind of information you expected for that field, and be extra careful if you want to allow arbitrary text. Otherwise they can do nasty things like breaking databases or sending spam from your website.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1143878

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice