Hi Deepali,

To retrive the value of $txt_name use following code:

$tp = ${$txt_name};

where $tp will have the value

Some how i feel that rather than using variable names like this it would be better if ou'd use arrays .

There is this very good article at www.devshed.com on variable variables in php ( the one we are using here $$ )

For Optimal Solution Providers
 

T. Srinivas

>From: Deepali Naik

>Reply-To: linuxers@mm.ilug-bom.org.in
>To: linuxers@mm.ilug-bom.org.in
>Subject: [ILUG-BOM] PHP help needed!!!!!!
>Date: Fri, 21 Mar 2003 10:27:07 +0600 (IST)
>
>Hello,
>i m new in the PHP area... i have one doubt on PHP... can u help me to solve this doubt?
>
>in my code i m slecting first name and last name of users who are not deleted..... so this number may be anything,...
>so i have kept a counter for that.. to know how many users are there?..
>now in the while loop i m displying the first and last name and also a text box to wewrite reason to delete user...
>the input type text name i m generating... like re1, re2, re3
>
>
>
>
>****************// php code
>
>echo \" \\n\";
>for ($counter=1;$counter<=11;$counter++)
>{
>// the below function searches in the db & returns the designation of user...
> $desg= disp_desg($counter);
>
>/// query to slect the user who is not deletd and of above desgination...,.
>
> $res =@mysql_query(\"select fname,lname from user_details where code =$counter and act_flag!=\'X\' and act_flag !=\'DE\' \");
>
>/// as many number of user
>
> while ( $row =@mysql_fetch_array($res))
> {
> if ($counter_chk==1){
> echo \"

$desg

\\n\"; }#end of if
>
>// BELOW LINE GENERATE THE INPUT TYPE TEXT NAME LIKE re1.. re2.. etc...
> $txt_name=\"re\".$counter_chk;
> $fname=$row[fname];
> $lname=$row[lname];
> echo \" \\n\";
> $counter_chk++;
> }#end of while
>}#end of for
>?>
>
$fname \".\" \".\"$lname
>
>***************// end of php code
>
>
>till here it works fine...
>
>now my problem is i don;t know the bnames of the input type text box...
>i want to check that the text box is empty or not... but since i have generated text box name... asnd not hardcoded.. i m not getting how to get the data inside the text box...
>
>i have cterated a fiollowing funtion where i want to delete a user where the reson text box is not empty
>
>********************* php code
>// counter_chk = no of users displayed oin the page
>function delete_user($counter_chk)
>{
>$count=$counter_chk;
>while ($count >= 1)
>{
> in this while i want to check that the input tuype text box is empty or not
>if not empty i want to update my table with the text in the input type of textbox...
>but i don;t know how to retrieve the value of the text box....
>
> $txt_name=\"re\".$count;
> echo \"$txt_name\";
> $count--;
>}#end of while
>}
>
>********************** end of php code
>
>what shd i do?.. is their any way to solve the prob...
>ort can u suggest me some other way..?..
>thanks in advance...
>waiting for ur reply...
>Deepali
>-------------------------------------------------
>Sify Mail - now with Anti-virus protection powered by Trend Micro, USA.
>Know more at http://mail.sify.com
>
>Sify Power mail- a Premium Service from Sify Mail!
>know more at http://mail.sify.com
>
>--
>
>
>http://mm.ilug-bom.org.in/mailman/listinfo/linuxers


Cricket - World Cup 2003 News, Views and Match Reports.