nec9716 Posted April 2, 2008 Share Posted April 2, 2008 there few thing I still not understand <input type:hidden....what hidden do exactly? I don't want to post all my script ( kind of long ) but in this script what $handle do ? function show_form($handle='',$data='') { $name = ''; $team = ''; $id = ''; $value = 'Add'; //submit button value $action = 'add'; //default form action is to add a new kid to db //set the action based on what the user wants to do if ($handle) { //set form values for button and action $action = "edit"; $value = "Update"; //get the values from the db resultset $row = mysql_fetch_array($handle); $name = $row['name']; $team = $row['team']; $id = $row['id']; }//end if //error handling from the processing form function if($data != '') { $elements = explode("|",$data); $name = $elements[0]; $team = $elements[1]; $id = $elements[2]; } ?> <body> <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?action=<?php echo $action?>"> <table width="60%" align="center" border="0" cellspacing="0" cellpadding="0"> <tr> <input type="hidden" value="<?php echo $id?>" name="id"> </tr> <tr> <td align="right">Name: </td> <td><input name="name" type="text" value="<?php echo $name?>"> </td> </tr> <tr> <td align="right">Team Name: </td> <td><input name="team" type="text" value="<?php echo $team?>"> </td> </tr> <tr> <td colspan="2" align="center"><input name="submit" type="submit" value="<?php echo $value?>"> <input name="reset" type="reset" value="Clear Form"></td> </tr> </table> </form> </body> <? }//end function Link to comment https://forums.phpfreaks.com/topic/99261-if-someone-can-explain-me-few-thing/ Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 1/ Hides the form element from display. 2/ Pretty hard to read your code because there is no indentaion and you failed to post your code in the provided tags but, it would appear it doesn't do much. If you pass this function anything as its first argument ($handle) then $action will be set to edit and $value will be set to Update otherwise they are both set to the default of add. Link to comment https://forums.phpfreaks.com/topic/99261-if-someone-can-explain-me-few-thing/#findComment-507874 Share on other sites More sharing options...
nec9716 Posted April 2, 2008 Author Share Posted April 2, 2008 ok one thing at the time Hides the form element from display....so in my script the input name id will be hide? Link to comment https://forums.phpfreaks.com/topic/99261-if-someone-can-explain-me-few-thing/#findComment-507880 Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 Yes, by the way this is a html question, nothing to do with php. Link to comment https://forums.phpfreaks.com/topic/99261-if-someone-can-explain-me-few-thing/#findComment-507881 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.