0_insomniac_0 0_insomniac_0 - 1 month ago 7
PHP Question

external php echo/print_r not outputting values to browser

This is code is saved in a file called form.php


<html>

<head>
<title>Form</title>
</head>

<body>
<form acion = "insert.php" method = "POST">
UserName:<br> <input type = "text" name = "uname"/><br>
Password:<br><input type = "password" name = "pswd"/><br>
First Name:<br><input type = "text" name = "fname"/><br>
Last Name:<br><input type = "text" name = "lname"/><br>
<input type = "submit" value = "submit"/>
</form>
</body>

</html>


This code is saved in a file called insert.php in the same folder (xampp/htdocs/aform)

<?php
echo "hello world";

$uname = $_POST['uname'];

print_r($_POST['uname']);

$pass = $_POST['pswd'];
$first = $_POST['fname'];
$last = $_POST['lname'];

print_r($_POST['uname']);
echo $uname;

?>


None of the echo or print_r statements return anything to the browser after the submit button is clicked.

Answer

Just correct this (you have a missing 't'):

<form acion = "insert.php" method = "POST">

To:

<form action = "insert.php" method = "POST">
Comments