intégrer select dans une page php

Petit nouveau ! | 5 Messages

25 mars 2012, 03:16

Bonsoir,

Pour ajouter la météo à mon blog, quelqu'un pourrait-il m'aider à intégrer une select liste dans une page php s'il vous plait !

code initial :
<?php
include('weather.class.php');
$zip = "FRXX0055";
define('DEFAULT_UNITS', "c");
define('IMAGES', 'icons/sm/');
if($zip != '')
{
	if (isset($_GET['units'])) {$s_unit_of_measure = strtolower($_GET['units']);}
	else {$s_unit_of_measure = DEFAULT_UNITS;}
	$weather = new Weather();
	$weather = $weather->getWeather($zip, $s_unit_of_measure);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test List Php</title>
</head>
<body>
<table>
  <tr>
    <td>Lyon</td>
  </tr>
</table>
</body>
</html>
modification prévue :
<?php
include('weather.class.php');
$zip = "ICI LA VALEUR DE L’ITEM DU SELECT";	
define('DEFAULT_UNITS', "c");
define('IMAGES', 'icons/sm/');
if($zip != '')
{
	if (isset($_GET['units'])) {$s_unit_of_measure = strtolower($_GET['units']);}
	else {$s_unit_of_measure = DEFAULT_UNITS;}
	$weather = new Weather();
	$weather = $weather->getWeather($zip, $s_unit_of_measure);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test List Php</title>
</head>
<body>
<table>
  <tr>
    <td>ICI LE NOM DE L’ITEM DU SELECT</td>
    <td>ICI LA LISTE SELECT</td>
  </tr>
</table>
</body>
</html>
la liste select :

Code : Tout sélectionner

<select id ="" class="" onchange =""> <option value="FRXX0055">Lyon</option> <option selected value="FRXX0076">Paris</option> <option value="FRXX0059">Marseille</option> <option value="FRXX0095">Strasbourg</option> </select>
Merci pour votre aide

ViPHP
xTG
ViPHP | 7331 Messages

25 mars 2012, 10:16

Voilà de quoi comprendre comment faire cela : http://phpdebutant.org/article56.php :)