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,474
    Thanks
    63
    Thanked 537 Times in 524 Posts
    Unless you show us more code there is no way we can help you.
    I can't really think of anything to write here now...

  • #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 08:04 PM.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    And what was the result of the modification I asked for in your thread here: http://www.codingforums.com/showthread.php?t=251813

  • #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,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 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
    •