Form data not entering database

Discussion in 'PHP' started by pictureboarduk, Mar 10, 2009.

  1. #1
    Hi there,

    I am trying to insert some data into my database, and although a row is being created, none of the user's data is entering the database, and I was hoping someone could explain why.

    Here is my form:

    and here is insert.php:

     
    pictureboarduk, Mar 10, 2009 IP
  2. exodus

    exodus Well-Known Member

    Messages:
    1,900
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    165
    #2
    In your webform you didn't provide the method. You need to add METHOD="POST", because your reading in your $_post var. I strongly suggest you get a good variable cleaning function before you insert anything into SQL.
     
    exodus, Mar 10, 2009 IP
    pictureboarduk likes this.
  3. wizkid0319

    wizkid0319 Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    yeah... or else give me your domain name so i can run a sql injection on your DB...
    jus kidding...
    clean your data before sending into the DB.

    cheers
     
    wizkid0319, Mar 11, 2009 IP
    pictureboarduk likes this.
  4. adstiger

    adstiger Peon

    Messages:
    409
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    What is variable cleaning? Which function do it?
     
    adstiger, Mar 11, 2009 IP
  5. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #5
    Setting form method is the same as adding a name to your input fields ! If you don't set one of these - your form will not work ( in case if there are no name for input field or method is not set correctly, you will not be able to use it ).
     
    ActiveFrost, Mar 11, 2009 IP
    pictureboarduk likes this.
  6. pictureboarduk

    pictureboarduk Well-Known Member

    Messages:
    551
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Worked a treat, thanks guys/gals.
    Know it was something daft.

    Reps to you all.
     
    pictureboarduk, Mar 11, 2009 IP
  7. adstiger

    adstiger Peon

    Messages:
    409
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Please share with us, the solution that worked.
     
    adstiger, Mar 11, 2009 IP
  8. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #8
    <form name="answer" action="read.php" method="GET">
    <form name="answer" action="read.php" method="POST">
    PHP:
     
    ActiveFrost, Mar 11, 2009 IP