0

I'm new to PHP and learning PHP by myself.Here I want to get the output value of text fields using php code but it gives me an error .can anyone point out the error .

here is my code test.php .................

 <?php

 $nameone=$_POST['nameone'];
 echo $nameone;

 ?>


 <hr/>
 <h1>fgdhgf</h1>
 <form action="test.php" method="POST">
 <input type='text' id='nameone' name='nameone' >
 <input type='text'name='name2'>
 <input type="submit" value="submit" name="roll">
 </form>
Erandi
  • 719
  • 3
  • 7
  • 16

1 Answers1

0

you have to change the (action = "test.php") to (action = "") to inform the HTML to look inside the same page for php code . You are telling the HTML to look for another test.php page in your directory.

and you have to put @ sign before ($_POST['someone']) to escape the first undefined index error when you load the page .

Sorry for my poor formatting , I am from a smartphone

ahmedHusseinF
  • 30
  • 1
  • 7