|
|
|
| Title : |
GetCombo
Combo-BOX - Abstraction With function you can retrieve the combo-box structure with its data. |
| Categories : |
PHP, HTML and PHP |
 jose di |
| Date : |
Feb 15th 2001 |
| Grade : |
3 of 5 (graded 2 times) |
| Viewed : |
5112 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by jose di |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
<?php
function GetCombo_Where($db, $nombre, $tabla, $campo_lista, $campo_graba,
$campo_seleccionado,$valor_seleccionado,$where)
{
$query="SELECT * FROM $tabla ";
$query.=($where)?"WHERE ".$where:"";
$db -> query ($query);
$cant_registros = $db -> num_rows ( );
$string = "<select name=".$nombre.">";
if ($seleccionado=="")
$string .="<option></option>";
for ($i=1;$i<=$cant_registros;$i++)
{
$db -> next_record ( );
$value = $db -> Record[$campo_graba];
if ($valor_seleccionado == $db -> Record[$campo_seleccionado])
$string .= "<option selected value = ".$value." >";
else
$string .= "<option value = ".$value." >";
$string .= $db -> Record[$campo_lista];
$string .= "</option>";
}
$string .= "</select>";
return $string;
}
?>
How to use it----> GetCombo_Where(database,combo name,table,output combo text, combo value, table row selected, table
value selected, sql where statement without
where clause ); |
|
| 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 | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | Pseudo Non Parsed Header. Output to the the browser as the script runs. Categories : PHP, HTTP, HTML and PHP | | | PageRank Display Categories : Search Engines, HTML and PHP, PHP | | | mySQL/PHP/search with multientry
form and table output with colored rows Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases | | | Print out array key => value in colored HTML Categories : PHP, Arrays, HTML and PHP | | | XTemplate, a template class for PHP Categories : PHP Classes, HTML and PHP, PHP | | | Upload Script, Upload File Script, Input Type="File" Categories : PHP, HTML and PHP, HTTP | | | Opening and formatting text files into HTML on the fly- or HTML from templates. Categories : PHP, HTML and PHP, Filesystem | | | The Nearly Perfect Contact Us Form Categories : PHP, Form Processing, HTML and PHP | | | This script shows you the 7th latest php items from the mailing list archive on zend.com Categories : HTML, HTML and PHP, HTTP, PHP | | | AITSH Statistics Categories : Complete Programs, Databases, HTML and PHP, Sessions, PHP | | | Parse html (title :: meta) Categories : PHP, HTML and PHP, Regexps | | | Creating thumbnails from MySQL Blobs online Categories : PHP, MySQL, Graphics, HTML and PHP, Databases | | | Customizable encoding and decoding strings with security. Categories : PHP, Strings, HTML and PHP | |
| |
| |
|