|
|
|
|
Like this code?
Show the author your appreciation.
|
|
| |
This is the simple code that generate the textbox,redio button, checkbox, select box
This is for beginner of php programmer
|
<?
function genTextbox($type,$name,$value,$makeReadOnly='no',$size=20)
{
if($makeReadOnly=='yes') {
$read='readonly=\'\'';
} else {
$read='';
}
return "<input type='$type' name='$name' value='$value' size='$size' $read>";
}
function genSelect($name,$makemultiple='no',$optvalue,$optdisplay)
{
if($makemultiple=='no') {
$make='';
} else {
$make='MULTIPLE';
}
if(!array($optvalue)) {
return false;
}
$output="<select name='$name' $make>";
for($i=0;$i<sizeof($optvalue);$i++) {
$output.="<option value='$optvalue[$i]'>$optdisplay[$i]</option>";
}
$output.="</select>";
return $output;
}
echo genTextbox('text','user','UserName')."<br>";
echo genTextbox('password','pass','Password','yes')."<br>";
echo genTextbox('radio','gender','Male')."<br>";
echo genTextbox('radio','gender','Female')."<br>";
echo genTextbox('checkbox','ql','SLC')."<br>";
echo genTextbox('submit','submit','Submit')."<br>";
$val=array("Nepal","China","Tibet");
echo genSelect('country','yes',$val,$val);
?> | | |
|
| Simple POST and GET example Categories : PHP, Beginner Guides, Form Processing, HTML and PHP | | | Real simple example of removing HTML tags from text then changing \n (new line) to <br>. Could be used in a forum for instance. Categories : HTML, PHP, HTML and PHP, Beginner Guides | | | PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | Dynamic form field Categories : PHP, HTML and PHP, Form Processing | | | Basic Authentication with sessions Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions | | | PHP and javascript mouseover, mouseout, and mousedown events Categories : PHP, Java Script, Form Processing, Beginner Guides | | | Sql Builder Categories : PHP, HTML and PHP, Databases, General SQL, Form Processing | | | Newbie Notes #1 - Making a form return to itself Categories : PHP, Beginner Guides, HTML and PHP | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | Form Submission Using Array's Categories : PHP, HTML and PHP, Beginner Guides, Arrays | | | Multiple Select box, Select multiple Items from Menu.List box Categories : PHP, HTML and PHP, Beginner Guides | | | The Nearly Perfect Contact Us Form Categories : PHP, Form Processing, HTML and PHP | | | How to Create a Shoutbox Using PHP & MySQL Categories : PHP, MySQL, Web Applications, Beginner Guides, HTML and PHP | | | Newbie Notes #9 - Hyperlinking a post Categories : PHP, Java Script, HTML and PHP, Beginner Guides | | | Kewl Date Example Categories : PHP, HTML and PHP, Date Time, CSS, Beginner Guides | |
|
|