|
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:27 am Post subject: table+input type text |
|
|
ciao ho appena cominciato ad usare smarty ma non riesco a fare una tabella con all'interno delle checkbox o altro per fare un form ben ordinato
sapete dirmi come si fa |
|
Back to top |
|
Zan83 Smarty Rookie
Joined: 27 Oct 2006 Posts: 12
|
Posted: Fri Oct 27, 2006 1:37 pm Post subject: |
|
|
Vi domando: è corretto creare un form all'interno di una tabella nel modo che ho usato qui sotto o ci sono modi migliori?
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> |
|
Back to top |
|
flatfield Smarty Rookie
Joined: 30 Apr 2007 Posts: 18 Location: Genova (Italy)
|
Posted: Thu May 24, 2007 2:13 pm Post subject: |
|
|
Interessante questa discussione... avete nuove esperienze a riguardo? |
|
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
|