Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    1
    Thanked 1 Time in 1 Post

    Input not being read and stopping the php listing

    My php program does not execute past the inputs. It does not go past to the mysql_connect etc. It works without the two inputs then manually coded in the INSERT. In my htm program works with two input boxes. Why are my inputs not working?

    Code:
            $name = filter_input(INPUT_POST, "name");
            $email = filter_input(INPUT_POST, "email");
    Also, in my other programs have 14 inputs. They all fit as fields. Is that a problem?

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,327
    Thanks
    60
    Thanked 525 Times in 512 Posts
    Blog Entries
    4
    Unless you show us more code there is no way we can help you.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    New Coder
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    1
    Thanked 1 Time in 1 Post
    table1 has 4 fields ('id', 'datetime', 'user1', 'pass1'). Both name and email have their counterparts in .htm code <input type="text" name="name"> etc.

    filter_input(INPUT_POST, "name") gets locked up before it gets to the echoes and does not even get to mysql_connect. This baffles me. Why would a simple input not work?

    Code:
    <?php
            $name = filter_input(INPUT_POST, "name");
            echo $name;
            $email = filter_input(INPUT_POST, "email");
            echo $email;
            $conn = mysql_connect('localhost', 'username1', 'password1') or die(mysql_error());
            echo "Connection made.";
            mysql_select_db('database1');
            $sql = "INSERT INTO table1 VALUES (null, now(), '$name', '$email');";
            $result = mysql_query($sql, $conn) or die('Query failed: ' . mysql_error());
        ?>
    Last edited by Philosophaie; 02-18-2012 at 07:04 PM.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    And what was the result of the modification I asked for in your thread here: php not reading html code

  • #5
    New Coder
    Join Date
    Sep 2010
    Posts
    46
    Thanks
    1
    Thanked 1 Time in 1 Post
    Nothing at all happened. The program ran as designed. There must have been a server error or outage due to traffic.

    Code:
    ini_set('display_errors', 1);
    error_reporting(E_ALL);

  • #6
    New Coder
    Join Date
    Aug 2009
    Posts
    51
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philosophaie View Post
    Nothing at all happened. The program ran as designed. There must have been a server error or outage due to traffic.

    Code:
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    By saying there was no errors I presume the issue is now fixed?

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    And you also receive the "Connection made." message?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •