Jump to content

how to get hidden value?


chennaibala

Recommended Posts

hi frds...

<td width="25%"  align="left" scope="col"><input id="regid" name="regid" type="hidden" size="10" value="<?php 

			if (rehnum == null) 
			{
				$reg1="abc000001";
				echo "$reg1";
			}
			else
			{			

				$reg="art";
				$reg1="$reg"."$regid";
				echo "$reg1";
			}

				?> "></td>

i used post method:

$hiregid=$_POST["regid"];


 

i cannot get my hidden echo value while submit..how to get hidden value?thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/175197-how-to-get-hidden-value/
Share on other sites

Hi chennaibala,

 

You get hidden form data via the $_GET['POST'] method in exactly the same way as normal data.

 

I would suggest from your example that the problem is with your if/else statement.

 

If you view the source of your page, is the hidden input field populated with a value?

<td width="25%"  align="left" scope="col"><input id="regid" name="regid" type="text" size="10" value="<?php 
				include 'db0.php'; 
				$query="SELECT LPAD(MAX(SUBSTR(id,4))+1,6,0) as NextNum FROM registrater"; 
			$result = mysql_query($query) or die ("Error in query: $query " . mysql_error()); 
			$row = mysql_fetch_assoc($result); 
			$num_results = mysql_num_rows($result); 
			//echo "NextNum:".$row['NextNum']."end|  ";

			if ($row['NextNum'] == null) 
			{
				$reg1="abc000001";
				echo "$reg1";
			}
			else
			{				
				$regid=$row['NextNum'];
				$reg="abc";
				$reg1="$reg"."$regid";
				echo "$reg1";
			}

				?> "></td>

i used post method:

$hiregid=$_POST["regid"];


 

above is my actual coding....i can get my echo value,when type ="text"...when i change to type ="hidden"..i get value as null..

thanks in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.