I want to retrieve the data from a textbox which I created. Please take look at my code and help me.
<?php
if(isset($_GET['ok']))
{
$a=1;
$n=$_GET['n'];
for($i=0;$i<$n;$i++){
echo '<form action="exa.php" method="get">';
echo '<input type="text" name="kal'.$a.'"/> <br/>';
echo '</form>';
$a++;} $a=1;
for($i=0;$i<$n;$i++)
{
$txtnm="kal".$a;
$kal=$_GET['$txtnm'];
echo $kal;
$a++;
}
}
?>
<html>
<body>
<form action="exa.php" method="get">
<input type="text" name="n"/><br/>
<input type="submit" value="OK" name="ok"/>
</form>
</body>
</html>
Here I am getting an error saying 'undefined index $txtnm'
$kal=$_GET['$txtnm'];- Remove the quotation marks.