Ahmed Abbas Ahmed Abbas - 3 months ago 9
HTML Question

Text Box data not showing in PHP

In PHP, text is not showing when I type in textbox and click on submit.
Sorry for such a dumb question.

<body>
<form action="process.php" method="post">
Username: <input type="text" name="user" value=""/>
<br>
Password: <input type="text" name="pass" value=""/>
<br>
<input type="submit" name="submit" value="Submit"/>
</form>
</body>


Process.php is in external file

<?php
if(isset($_POST['submit'])){
$username=$_POST['user'];
$password=$_POST['pass'];

echo $password;
echo $username;
}

//echo $username." ".$password;
?>

Answer

It works fine on my server by your code,so I suggest you troubleshoot as follows:

  1. see console whether has errors
  2. only write echo 'hello'; to see whether php engine works fine
  3. if page is jump and show noting after you click submit, check php error_log to see whether code has syntax or other error
  4. add var_dump($_POST); to dump all post data received