update-butxaca.php
changeset 0 c270c8b5ddea
equal deleted inserted replaced
-1:000000000000 0:c270c8b5ddea
       
     1 <?php
       
     2 /***** Informació de LOCALE *****/
       
     3 echo setlocale(LC_ALL, 'ca_XX');
       
     4 $textdomain = "butxaques";
       
     5 bindtextdomain($textdomain, "./locale");
       
     6 textdomain($textdomain);
       
     7 bind_textdomain_codeset($textdomain, "utf-8");
       
     8 ?>
       
     9 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
       
    10 <html>
       
    11 <head>
       
    12 <title><?php echo _("Control de butxaques")." - "._("Nova butxaca");?></title>
       
    13 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
       
    14 <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
       
    15 </head>
       
    16 
       
    17 <body>
       
    18 <?php
       
    19 echo "<h1 align=center>" . _("Control de butxaques") . "</h1>\n";
       
    20 echo "<h2>" . _("Nova butxaca") . "</h2>\n";
       
    21 
       
    22 include ("./strings.inc");
       
    23 
       
    24 if (!isset($_POST["afegir"]))
       
    25 {
       
    26 ?>
       
    27 
       
    28 <FORM method=post action="update-butxaca">
       
    29 <table>
       
    30 <tr>
       
    31 	<th><?php echo _("Nom de la butxaca") ?>
       
    32 	<td><input type="text" name="nom" size=20 maxlength=50>
       
    33 </table>
       
    34 <center>
       
    35 <input type=submit value="<?php echo _("Afegir butxaca");?>" name=afegir>
       
    36 <input type=reset value="<?php echo _("Ressetejar formulari");?>">
       
    37 </center>
       
    38 </form>
       
    39 <?php
       
    40 }
       
    41 else // if afegir
       
    42 {
       
    43 	// ****** Falta comprovar si el nom és NULL
       
    44 	include("getdb.inc");
       
    45 
       
    46 	// Fem la connexió
       
    47 	$connexio = mysql_connect($mysql_server, $mysql_user,
       
    48 	$mysql_password);
       
    49 	mysql_select_db($mysql_db, $connexio);
       
    50 
       
    51 	// Escrivim
       
    52 	$query = "INSERT INTO butxaques (nom) VALUES('" .
       
    53 		strtosql($_POST["nom"]) . "');";
       
    54 
       
    55 	$resultat = mysql_query($query, $connexio);
       
    56 
       
    57 	if (!$resultat)
       
    58 	{
       
    59 		echo "<p>";
       
    60 		echo sprintf(_("<STRONG>ERROR:</STRONG> Error al actualitzar" .
       
    61 			"les dades a <STRONG>%s</STRONG>!"), "butxaques");
       
    62 		echo "</p>";
       
    63 		echo mysql_errno().": ".mysql_error()."<BR>";
       
    64 	}
       
    65 	else
       
    66 		echo _("<p>Inserció efectuada correctament.</p>");
       
    67 }
       
    68 ?>
       
    69 
       
    70 <p><A HREF="index"><?php echo _("Tornar al menú principal");?></A></p>
       
    71 
       
    72 </body>
       
    73 </html>