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 "<table>\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 "<p align=left><b><u><font face=\"Bookman Old Style\" size=\"3\"> $desg</font></b></u></p>\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 "<tr> <td> $fname "." "."$lname </td> <td> <input type=\"text\" name=\"$txt_name\" size=\"45\"> </td></tr>\n"; $counter_chk++; }#end of while }#end of for ?> </table>
***************// 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
This is a classic problem. You need to have an index which you can regenerate from the database (e.g. record id or employee number or something like that.)
When you generating names of the text boxes you have to generate them in a way, so that you can generate the same sequence everytime. Only then you can match the submitted text with the original text. Other idea could be to send the orignial name (first name + last name) as hidden variables in the form.
Amitay.
On Fri, 2003-03-21 at 09:57, Deepali Naik wrote:
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 "<table>\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 \"<p align=left><b><u><font face=\\\"Bookman Old Style\\\" size=\\\"3\\\"> $desg</font></b></u></p>\\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 "<tr> <td> $fname "." "."$lname </td> <td> <input type=\"text\" name=\"$txt_name\" size=\"45\"> </td></tr>\n"; $counter_chk++; }#end of while }#end of for ?>
</table>
***************// 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