cant get value
Posted: Mon Jan 10, 2011 1:45 am
Hi friends,,,,
just look the following code,,,
//Fir.php
//gm.php
After executing the fir.php if see the url address the "txt" value would be our given value,,,, but echo statement print nothing,,,, wat s the prob,,,,
just look the following code,,,
//Fir.php
Code: Select all
<html>
<head>
<title>Group box</title>
<?php
include "tacre.php";
echo '<script language=javascript>
function add()
{
var str=document.getElementById("txt").value;
var k =document.createElement("option");
document.getElementById("cr").options.add(k);
k.text=str;
alert(str);
var lastvalue = document.getElementById("cr").options[document.getElementById("cr").options.length-1].value;
alert("last " + lastvalue);
}
</script>';
?>
</head>
<body>
<div style="position:absolute;left:10px;top:100px">
<form name=fr action=gm.php>
Enter the Group name <br>You want to create:
<input type=text id=txt name=txt style="position:absolute;left:150px;top:10px" ><br>
<select id=cr name=sel style="position:absolute;left:350px;top:10px" >
<option>None</none>
</select><br>
<input type=submit onClick="add();" name =cre value=Create style="position:absolute;left:150px;" >
</form>
</div>
</body>
</html>Code: Select all
<?php
$last=$_POST['txt'];
echo $last;
?>