|
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 |
Zan83 Smarty Rookie
Joined: 27 Oct 2006 Posts: 12
|
Posted: Fri Oct 27, 2006 9:39 am Post subject: nececito ayuda con el smarty tambien yo |
|
|
no logro ad hacer una table di checkbox. como se hace?
|
|
Back to top |
|
mrtinez Smarty Rookie
Joined: 31 Jan 2005 Posts: 26 Location: Mexico
|
Posted: Fri Oct 27, 2006 1:10 pm Post subject: necesito ayuda con el smarty tambien yo |
|
|
Hola, tal vez seria bueno que nos mencionaras que error te manda para poder saber por donde te esta fallando, mira usando el ejemplo del manual pude realizar el Checkboxs sin problemas
esto en el PHP
$sm->assign('cust_checkboxes', array(1000 => 'Joe Schmoe',
1001 => 'Jack Smith',
1002 => 'Jane Johnson',
1003 => 'Charlie Brown')
);
$sm->assign('customer_id', 1001);
esto en la Plantilla
{html_checkboxes name="id" options=$cust_checkboxes selected=$customer_id separator="<br />"} |
|
Back to top |
|
Zan83 Smarty Rookie
Joined: 27 Oct 2006 Posts: 12
|
Posted: Fri Oct 27, 2006 1:46 pm Post subject: |
|
|
esto es lo que yo he hecio :
nuovaAuto.php
<?
require "C:\Programmi\EasyPHP1-8\php\guestbook\setup.php";
$smarty = new Smarty_GuestBook();
$smarty->clear_all_cache();
$smarty->assign('casa','casa');
$smarty->assign('modello','modello');
$smarty->assign('km','km');
$smarty->assign('codice','codice');
$smarty-> assign('siono', array(
1=>"si",
0=>"no"
)
);
$smarty->assign('selezionato','1');
$smarty->display('nuovaAuto.tpl');
?>
---------------------------------
nuovaAuto.tpl:
<html>
<form method="GET" action="inserisci.php">
<b>Inserisci i dati della nuova auto</b>
<table>
<tr><td> {$casa|capitalize} </td><td><input type="text" name={$casa|capitalize}></td>
<tr><td> {$modello|capitalize} </td><td><input type="text" name={$modello|capitalize}></td>
<tr><td> {$km|capitalize} </td><td><input type="text" name={$km|capitalize}></td>
<tr><td> {$codice|capitalize} </td><td><input type="text" name={$codice|capitalize} size="3" MAXLENGTH=3 ></td>
<tr><td>Disponibile</td><td>{html_radios name="siono" options=$siono selected=$selezionato }</td>
</table>
<input type="submit" value=Inserisci>
</form>
</html>
------------------------
inserisci.php :
<?
require "C:\Programmi\EasyPHP1-8\php\guestbook\setup.php";
include("database.php");
$smarty = new Smarty_GuestBook();
$conn = new database;
$db = $conn->connetti();
?>
<html>
<?
print_r($HTTP_GET_VARS);
$casa = $HTTP_GET_VARS["Casa"];
$modello = $HTTP_GET_VARS["Modello"];
$km = $HTTP_GET_VARS["Km"];
$disponibile = $HTTP_GET_VARS["siono"];
$codice = $HTTP_GET_VARS["Codice"];
$sql = " INSERT INTO auto VALUES ('".$casa."','".$modello."','".$km."','".$disponibile."','".$codice."') ";
echo $sql;
$result = $db->query($sql);
if($result) { $smarty->assign('testo',"Inserimento completato");}
else {$smarty->assign('testo',"errore");}
$db->disconnect();
?>
</html>
--------------------------------
no me manda error perņ no soy seguro si es hecio bien,si se hace asi. |
|
Back to top |
|
mrtinez Smarty Rookie
Joined: 31 Jan 2005 Posts: 26 Location: Mexico
|
Posted: Fri Oct 27, 2006 5:09 pm Post subject: nececito ayuda con el smarty tambien yo |
|
|
Hola de nuevo, mira acabo de probar tu codigo e independientemente de como programa cada uno, el script funciona, lo unico que cambio fue la forma en la que recibo los datos en el PHP.
yo los recibo de esta manera:
$disponible = $_GET["siono"];
de esta manera recibo el valor selecionado en el RADIO sin problema alguno.
espero te sea de utilidad. |
|
Back to top |
|
Zan83 Smarty Rookie
Joined: 27 Oct 2006 Posts: 12
|
Posted: Tue Oct 31, 2006 7:59 am Post subject: |
|
|
gracias por l'ayuda. |
|
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
|