Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm creating two pages in php and I need to post the textbox value in one page to another page.. I've tried,

HTML
<form action="test11.php" name="firstSubmit" method="POST">
       				   
                        <p>Total no. of right answers : 
						<input type="text" name="ans" value="<?php echo $right_answer;?>" disabled /></p>
						<p>Total no. of wrong answers : 
                        <input name="wrong" type="text" id="score1" value="<?php echo $wrong_answer;?>" disabled /></p>
						<p>Total no. of unanswered questions : 
                        <input name="unans" type="text" id="score2" value="<?php echo $unanswered;?>" disabled /></p>                
						<button class="btn btn-success btn-block" type="submit">
								Get your certificate
							</button><br><br>
                       
					   </form>




and,

PHP
<?php
$s = $_POST['ans'];
?>


But it will shows the error like "Notice: Undefined index: ans in C:\xampp\htdocs\nquiz1\test11.php on line 2".

Help me to do this...


Thanks in advance,
Priya
Posted
Updated 26-Feb-15 18:30pm
v2
Comments
enhzflep 27-Feb-15 2:47am    
You can always try using var_dump( $_POST ); to see what/how is passed.
Priya Murugan 27-Feb-15 3:29am    
thank u...
Is it resolved?
enhzflep 27-Feb-15 6:29am    
You're welcome. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900