here is the test.html

<html>
<body>

<form action="test1.php" method=post>
Name :<input name= "name" type="text">

</body>
</html>

And here it is the test1.php

<?php
$name= $_POST['name'];
echo $name;


?>

But it doesnt display the name .Can anyone help me ??

Dani AI

Generated

Blank page almost always means either PHP is not being executed at all or a PHP error is being suppressed. The snippets posted in the thread are fine; follow a short diagnostic checklist to find which of those two is happening. As suggested, "view source" is revealing: if the PHP appears raw in the browser, the server is not parsing PHP. The other useful points from the thread are relevant: check the form method/name (, ), confirm attribute quoting and spelling (), and make sure a PHP-capable stack is installed and running (, ).

  • Open the page through a web server URL (...) rather than using file://.
  • Confirm the form uses method="post" and the input really has a correct name attribute (no hidden typos or stray characters).
  • Make sure test1.php is in the web server document root and actually has a .php extension (Windows can hide the true extension).
  • Turn on error reporting and dump diagnostics so the runtime error or request content becomes visible.
  • If PHP source shows in the browser, enable/install a PHP runtime (local stacks like XAMPP/WAMP/MAMP) or enable the PHP handler in Apache/IIS.
  • Check the web server / PHP error logs for fatal errors.

Add this debug block at the very top of the PHP file to force error output and show what arrived from the form:

<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

var_dump($_SERVER['REQUEST_METHOD']);
var_dump($_POST);

Additional checks: avoid short PHP tags (use <?php), ensure files are saved without a UTF-8 BOM, and verify file permissions. Once errors are visible the root cause (parse error, misinstalled PHP, wrong path, missing POST data) will be clear and solvable.

Recommended Answers

All 16 Replies

<form action="test1.php" method="post">

That should fix your issues.

now my html code is this :

<html>
<body>

<form action="test1.php" method="post">
Name :<input name= "name" type="text">
<input type="submit" name="submit" value="submit!">

</form>

</body>
</html>

and test1.php is this :

<?php
$name= $_POST['name'];
echo $name;


?>

When I press the buttom submit I go in a blank page ..

change test1.php to this:

<?php
print_r($_POST);
?>

And post the output

Nothing . Blank page.
what I am doing wrong?

Try to change input name to something other.

Good question.
Looks like its the environment rather than the code, I tested the code and that runs fine.

Right click the page and view source, is the PHP code showing?

// wrong.
<input name= "name" type="text">
get rid of the spaces in your form.
<input name="name" type="text">

hi brother i have checked this code as well but nothing wrong with this so please try to look at you environment in which you are runing it

is your web server running?

Can anyone help me install CORRECT php ?????

Can you help me install correct php ?

Do you have MSN or something?

You can download a php server from the following link:
appservnetwork.com
If your operating system is Win7 then you should download the AppServ Open Project 2.5.10
If you have an older version of Windows you should download the AppServ Open Project 2.6.0
This project includes PHP, MySQL, phpMyAdmin and a PHP text processor.
Hope it helps.

hi here is the link

it's XAMPP and have each and every thing in it you just need to install it
mysql,php apache server will be automatically installed

Thank you vey much all!!!!!! :)

You're welcome.. If this thread has been solved, would you mind marking it as solved?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.