Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Casse tête débutant : formulaire et smarty

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
melimelo
Smarty n00b


Joined: 10 Apr 2007
Posts: 2

PostPosted: Tue Apr 10, 2007 12:30 pm    Post subject: Casse tête débutant : formulaire et smarty Reply with quote

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
View user's profile Send private message
escteban
Smarty Rookie


Joined: 20 Apr 2007
Posts: 10

PostPosted: Wed May 02, 2007 12:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP