user3161659
user3161659

Reputation: 1

php form does not works

I write this code but it seems does not works absolutely :(

This is the result:

Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0

Notice: Undefined variable: firstname in C:\Users\Mizo\PhpstormProjects\untitled3\success.php on line 2

Notice: Undefined variable: lastname in C:\Users\Mizo\PhpstormProjects\untitled3\success.php on line 2

Notice: Undefined variable: lastname in C:\Users\Mizo\PhpstormProjects\untitled3\success.php on line 2

Notice: Undefined variable: email in C:\Users\Mizo\PhpstormProjects\untitled3\success.php on line 2

<?php
$firstname="";
$lastname="";
$email="";
if(isset($_POST['submit'])){
$_POST["firstname"]=$firstname;

$_POST["lastname"]=$lastname;

$_POST["email"]=$email;

?>

<form action="success.php" method="post">
<label for id="firstname">Firstname</label>
<input type="text" name="firstname" id="firstname"  >
<br/>
<label for id="lastname">lastname</label>
<input type="text" name="lastname" id="lastname"  >
<br/>
<label for  id="email">E-mail cím</label>
<input type="email" name="email" id="email" >
<br/>
<input type="submit">
</form>
success.php
<?php
echo"$firstname,$lastname,$email";
?>

Upvotes: 0

Views: 73

Answers (2)

revo
revo

Reputation: 48711

However at the first glance you have semantic PHP errors (which @zoubida13 pointed out), I think you have earlier versions of PHP running as well.

Locate your php.ini file, then search for always_populate_raw_post_data directive and set its value to -1.

This warning appears regardless of whether your web app uses $HTTP_RAW_POST_DATA.

Upvotes: 0

zoubida13
zoubida13

Reputation: 1759

I assumed what you meant to do was :

$firstname = $_POST["firstname"];

$lastname = $_POST["lastname"];

$email = $_POST["email"];

Also you didn't close the bracket of your if.

Upvotes: 4

Related Questions