Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
table+input type text

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: Italian
View previous topic :: View next topic  
Author Message
Zan83
Smarty Rookie


Joined: 27 Oct 2006
Posts: 12

PostPosted: Fri Oct 27, 2006 9:27 am    Post subject: table+input type text Reply with quote

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


Joined: 27 Oct 2006
Posts: 12

PostPosted: Fri Oct 27, 2006 1:37 pm    Post subject: Reply with quote

Vi domando: corretto creare un form all'interno di una tabella nel modo che ho usato qui sotto o ci sono modi migliori? Very Happy

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


Joined: 30 Apr 2007
Posts: 18
Location: Genova (Italy)

PostPosted: Thu May 24, 2007 2:13 pm    Post subject: Reply with quote

Interessante questa discussione... avete nuove esperienze a riguardo?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Language: Italian 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