|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
melimelo Smarty n00b
Joined: 10 Apr 2007 Posts: 2
|
Posted: Tue Apr 10, 2007 12:30 pm Post subject: Casse tête débutant : formulaire et smarty |
|
|
Je développe mon premier site avec smarty/php (premier formulaire aussi :') et j ai un souci avec un select.
code html:(championnat.tpl)
<form method="post" action="mapage.php">
<select name ="division">
{html_options value=$idendivhtml options=$divhtml}
</select>
</form>
code php:(mapage.php)
<?php
//inclusion de la librairie
require_once('c:/wamp/www/smarty/libs/Smarty.class.php');
// Instanciation de l'objet Smarty
$oSmarty = new Smarty();
//Variables
$div = array ('Selection de la division','Division 1','Division 2','Division 3','Division 4');
$idendiv = array (0,1,2,3,4);
$monchoix=$_POST['division']
// assignation
$oSmarty->assign('divhtml',$div);
$oSmarty->assign('idendivhtml',$idendiv);
//Requête sql
.......
//Affichage du template après compilation
$oSmarty->display('championnat.tpl');
Voilà, en fait je voudrai récupérer la variable $monchoix pour ensuite l'utiliser dans une requete sql et afficher les résultats de celle-ci sur la meme page (mapage.php). Le problème est que je ne récupère jamais cette variable dans mon code. |
|
Back to top |
|
escteban Smarty Rookie
Joined: 20 Apr 2007 Posts: 10
|
Posted: Wed May 02, 2007 12:53 pm Post subject: |
|
|
Salut
Dans ton code deja il manque un ; de fin d instruction
-> $monchoix=$_POST['division'] !!!
Ca viendrait peut etre de la. Quand a la syntaxe de ton select,
je ne connais html_options, mais moi perso pour des <select> , j utilise un code html "normal" et ca marche tres bien
<select name ="division">
<option value="valeur">Nom</option>
</select>
En esperant avoir aidé.
Cordialement
Fabrice |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|