Page 1 of 1

how to get hidden value?

Posted: Wed Sep 23, 2009 11:18 pm
by chennaibala

Code: Select all

<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

Re: how to get hidden value?

Posted: Wed Sep 23, 2009 11:41 pm
by Ollie Saunders
i can get my echo value,when type ="text"...when i change to type ="hidden"..i get value as null.
That shouldn't affect it. What are you using to change the value? What might also be occurring as a result of making the value hidden?

The correct word for registrater is registrar, incidentally.

Re: how to get hidden value?

Posted: Thu Sep 24, 2009 4:38 am
by chennaibala
yes..when i insert in my table..it insert as empty field in that table..i dont know exactly..echo is for print purpose.....if its hidden..we cannot get that value frm hidden box...pls correct me if am wrong frds.. :(

Re: how to get hidden value?

Posted: Thu Sep 24, 2009 5:45 am
by Ollie Saunders
Please write as correctly as you can. The more effort you put into your communication the more likely others will put effort into their replies, and your future will benefit from the practice. For instance, "pls" should be please, you should obey capitalization rules, and I don't even know what "frds" is supposed to mean. Now — on to your query:
if its hidden..we cannot get that value frm hidden box...pls correct me if am wrong frds..
Hidden values are instructions to the client to send a specific key value pair to the server, just as a normal text field will send a key value pair to the server depending on what the user types into the field. The only difference between a hidden field and a text field is that a hidden field is given no visual representation in the browser; meaning that, a normal user is given no opportunity to alter the value that will be sent.
yes..when i insert in my table..it insert as empty field in that table.
How are you inserting it into the table? You haven't shown that code.
i dont know exactly..echo is for print purpose
Yes, it is. You can use var_dump() for more detailed information. Feel free to use both echo and var_dump() during development to tell you things about what your code is doing; you can remove them later.

Re: how to get hidden value?

Posted: Thu Sep 24, 2009 11:12 pm
by chennaibala
hi Ollie Saunders

sorry for my bad bad english....it not problem in inserting...problem found ,when i get value frm hidden text box is empty..if it text box,it return text box value to that variable..

Re: how to get hidden value?

Posted: Fri Sep 25, 2009 4:29 am
by Ollie Saunders
You say sorry and continue to abbreviate unnecessarily. Oh well; I won't push this point any further.

Are you giving your hidden field a value?:

Code: Select all

<input type="hidden" value="monkeys" />

Re: how to get hidden value?

Posted: Fri Sep 25, 2009 5:39 am
by r4r4
I have a form, the javascript currently checks that the user can only enter a positive integer, i need it also to check that the integer the uses enters is lower than the hidden value. I can supply the current code if it will help.

Re: how to get hidden value?

Posted: Fri Sep 25, 2009 6:18 am
by Ollie Saunders
r4r4 wrote:I have a form, the javascript currently checks that the user can only enter a positive integer, i need it also to check that the integer the uses enters is lower than the hidden value. I can supply the current code if it will help.
I doubt it will.