Newsgroup: it.comp.www.php
Titolo: INSERT

Ciao,
una delle cose più strane che mi siano mai successe... la mia query
INSERT..... inserisce (ogni tanto, quando gli gira) dei record, ma in questi
record non memorizza assolutamente le variabili che le passo... perchè
secondo voi ? Copio e incollo qui sotto i due files in questione (scusatemi
se viene fuori una roba chilometrica ^_^ ) :
FILE SIGNUP.PHP :
<?
 if (!isset($_POST['checkbox'])) {
  echo ("<span class='NEWStext'>You must read the rules to sign up!");
 }
 else {
echo ("<span class='NEWStext'>To register for the tour, please complete the
form below, with the
            fields marked with an * being required.</span><br>
            <form name='signup1' action ='signupaction.php' method = 'post'>
              <table>
                <tr class='NEWStext'>
                  <td>Name *</td>
                  <td><input type ='text' name = 'name'
class='NEWStext'></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Surname *</td>
                  <td><input type ='text' name = 'surname'
class='NEWStext'></td>
                </tr>
    <tr class='NEWStext'>
                  <td>Gender *</td>
                  <td><select name='gender' id='gender' class='NEWStext'>
                      <option value='Male'>Male</option>
       <option value='Female'>Female</option>
       </select></td>
                </tr>
                    <tr class='NEWStext'>
                  <td>Born (yr) *</td>
                  <td>");
$year = 1900;
echo ("<select name = 'born' id='born' class='NEWStext'>");
while ($year <= 2003) {
echo "<option value='$year'>$year</option>";
 $year++;
 }
       echo ("</select></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Country *</td>
                  <td><select name='country' id='country' class='NEWStext'>
                      <option value='Australia'>Australia</option>
                      <option value='Canada'>Canada</option>
                      <option value='Denmark'>Denmark</option>
                      <option value='England'>England</option>
                      <option value='Finland'>Finland</option>
                      <option value='France'>France</option>
                      <option value='Germany'>Germany</option>
                      <option value='Holland'>Holland</option>
                      <option value='Italy'>Italy</option>
                      <option value='Norway'>Norway</option>
                      <option value='Sweden'>Sweden</option>
                      <option value='Spain'>Spain</option>
                      <option value='Scotland'>Scotland</option>
                      <option value='USA'>USA</option>
                      <option value='Wales'>Wales</option>
                    </select></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Email *</td>
                  <td><input type ='text' name = 'email'
class='NEWStext'></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Password *</td>
                  <td><input name = 'password' type ='password'
class='NEWStext' id='password'></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Re-enter password *</td>
                  <td><input name = 'password2' type ='password'
class='NEWStext' id='password2'></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Level *</td>
                  <td><select name='level' id='level' class='NEWStext'>
                      <option value='Pro'>Pro</option>
                      <option value='Champ'>Champ</option>
                      <option value='Elite'>Elite</option>
                    </select></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Swing *</td>
                  <td><select name='swing' id='swing' class='NEWStext'>
                      <option value='Click'>Click</option>
                      <option value='RTS'>RTS</option>
                      <option value='PS'>PS</option>
                    </select></td>
                </tr>
    <tr class='NEWStext'>
                  <td>Tour(s) *</td>
                  <td><input type='checkbox' name='uscheck' value='1'> US
Tour&nbsp;&nbsp;&nbsp;|&nbsp;<input type='checkbox' name='eurocheck'
value='1'> European Tour</td>
                </tr>
                <tr class='NEWStext'>
                  <td>Favourite course</td>
                  <td><input name = 'fav' type ='text' class='NEWStext'
id='fav'></td>
                </tr>
                <tr class='NEWStext'>
                  <td>Links history</td>
                  <td><textarea name='infos' cols='30' rows='5'
class='NEWStext' id='infos'></textarea></td>
                </tr>
                <tr class='NEWStext'>
                  <td>&nbsp;</td>
                  <td><input name='submit' type='submit' class='NEWStext'
value='Submit'>
                    <input type = 'reset' class='NEWStext'>
     </td>
                </tr>
              </table>
</form><br>");
}
?>
FILE SIGNUPACTION.PHP
     <?
include("config.php");
include("functions.php");
     if (isset($uscheck)) {
     $us = 1;
     }
     else {
     $us = 0;
     }
     if (isset($eurocheck)) {
     $euro = 1;
     }
     else {
     $euro = 0;
     }
$connection = mysql_connect("$host" , "$dbuser" , "$dbpass");
$db = mysql_select_db("$dbname" , $connection);
$infos = instesto($infos);
$position = "Tour player";
$username = "$name $surname";
$query = "INSERT INTO
players(name,surname,country,level,swing,mail,infos,position,password,born,f
av,avatar,username,verifiedus,verifiedeuro,us,euro,gender)
VALUES('$name','$surname','$country','$level','$swing','$email','$infos','$p
osition','$password','$born','$fav','NULL','$username','0','0','$us','$euro'
,'$gender')";
$result = mysql_query($query);
echo ("<span class='testo'>Thankyou for registering with the Golftrak Tour.
Shortly you will be contacted by the Membership Coordinator confirming your
registration as a member with the tour. We look forward to your
participation on the tour and wish you the best of luck in your first
tournament.<br><br>Regards.<br><br>Steve Newsham (chairman)<span><br><br>");
?>
Grazie in anticipo ^_^
L.

 se viene fuori una roba chilometrica ^_^ ) :
Inizia a fare una cosa tipo:
if (!$query) exit(mysql_error());
Così hai l'errore... e poi penserei che ci siano apici qui e là che
incasinano tutto...controlla se percaso qualche "numero"
che dovrebbe essere inserito compare davvero (le variabili vuote non
restituiscono 0 ma il vuoto) e che non ci siano apici qui e là
in fase di inserimento e/o correggi con addlashes($variabile)
Ciao
Ju

 in fase di inserimento e/o correggi con addlashes($variabile)
ho controllato... ma niente, magari mi son perso qualcosa...
L.

 L.
Problema risolto... in un modo un pň strano, ma ora pare funzioni tutto...
ho sostituito la variabile cosě :
$variabile = $_POST['variabile']
L.