Reply to Re: radio buttons, checkboxes and dropdown menues

Your name:

Reply:


Posted by J.O. Aho on 11/23/06 10:00

Gaga wrote:
> Hi to all !
>
> How to insert one value of the radio button int db. ?
> <input type="radio" name="option" value="male">
> <input type="radio" name="option" value="female">
>
> ----------------------------------------------------------
> How to make the same but with checkbox ?
> <input type="checkbox" name="checkbox" value="male">
> <input type="checkbox" name="checkbox" value="female">
>
> ---------------------------------------------------------
> How to insert selected value from the dropdown menu ?
> <select name="year" id="year">
> <option>2005</option>
> <option>2006</option>
> </select>
>
> ---------------------------------------------------------------------
>
>

/* assume you have already connected to database and you use mysql */

/* change the "option" in the $_REQUEST[] to the name you used in the form */
$query="INSERT INTO table(column_name) VALUES('".$_REQUEST['option']."')";
/* if you use another database, change the mysql part to the one for your
database or odbc if your database isn't supported by php */
mysql_query($query);

As checkboxes may generate more than one value, the $_REQUEST['checkbox'] may
be a array in which you have to make a for loop.


//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация