WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Simple PHP Form Field Generator
Categories : PHP, Beginner Guides, Form Processing, HTML and PHP
Suraj Thapaliya
Date : Apr 25th 2006
Grade : 3 of 5 (graded 5 times)
Viewed : 15725
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Suraj Thapaliya
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

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