Indice del forum Olimpo Informatico
I Forum di Zeus News
Leggi la newsletter gratuita - Attiva il Menu compatto
 
 FAQFAQ   CercaCerca   Lista utentiLista utenti   GruppiGruppi   RegistratiRegistrati 
 ProfiloProfilo   Messaggi privatiMessaggi privati   Log inLog in 

    Newsletter RSS Facebook Twitter Contatti Ricerca
[PHP] strano problema con un form
Nuovo argomento   Rispondi    Indice del forum -> Linguaggi per Internet
Precedente :: Successivo  
Autore Messaggio
Nik
Semidio
Semidio


Registrato: 29/10/05 19:44
Messaggi: 204
Residenza: Grosseto - Maremma

MessaggioInviato: 27 Feb 2008 22:32    Oggetto: [PHP] strano problema con un form Rispondi citando

Devo realizzare (urgentemente!) un semplice form per la raccolta e l'invio di alcuni dati.

Fatto il form (in html), a posto il css... per il file php che deve eseguire l'invio prendo il codice di un altro script che avevo già usato più volte con successo...

completato il tutto, vado a provare e.... il modulo viene inviato... MA I DATI INSERITI NELLA FORM NON PASSANO! d'oh!

ho provato con il codice di un altro script... stesso discorso... ho pensato fosse un problema di server... quindi ho provato su un altro server... stessa pappa Brick wall

non so più che pesci prendere Confused

incollo il codice e ditemi se c'è qualcosa che non va

Codice:

<?php
$to = "info@xxxxxx.it";
$headers = "From: " . $_POST['mail'] . "\n";
// soggetto della mail
$subject = "Modulo dati xxxx";

// corpo messaggio
$body = "Contenuto del modulo:\n\n";

$body .= "Inviata da: " . trim(stripslashes($_POST["mail"])) . "\n"; //indirizzo e-mail mittente

$body .= "Cognome: " . trim(stripslashes($_POST["cognome"])) . "\n"; //cognome
$body .= "Nome: " . trim(stripslashes($_POST["nome"])) . "\n"; //nome
$body .= "Codice Fiscale: " . trim(stripslashes($_POST["codfisc"])) . "\n"; //C.F.
$body .= "Num. cellulare: " . trim(stripslashes($_POST["cell"])) . "\n"; //tel
$body .= "e-Mail: " . trim(stripslashes($_POST["mail"])) . "\n"; //email

$body .= "Targa: " . trim(stripslashes($_POST["targa"])) . "\n"; //targa
$body .= "Tipo veicolo: " . trim(stripslashes($_POST["veicolo"])) . "\n"; //tipo
$body .= "Massa complessiva: " . trim(stripslashes($_POST["massa"])) . "\n"; //massa
$body .= "Cilindrata veicolo: " . trim(stripslashes($_POST["cilindrata"])) . "\n"; //cilindrata

// invio mail
if (mail($to, $subject, $body, $headers)) // SE L'INOLTRO E' ANDATO A BUON FINE...
{
 echo "I dati sono stati inviati con successo. Grazie.";
} else {// altrimenti
 echo "Deve compilare la form prima di inviare.";
}
?>




e il form

Codice:

<form action="invio.php" method="post" enctype="text/plain">
<fieldset class="maschera">
<legend>Raccolta dati per xxxxxxxxxxxxxxxxxxxxxx</legend>
<center>
<h3><strong>TITOLO</strong></h3>
</center>
<p class="form">
<strong>Data decorrenza associazione: (gg/mm/aaaa)</strong> <input name="data" type="text" maxlength="10" size="10" />
<h3>Beneficiario Tessera</h3>
 <table>
  <tr>
    <td width="50%" valign="top"><strong>COGNOME</strong>: </td>
    <td width="50%" valign="top"><input name="cognome" type="text" maxlength="50" /></td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>NOME</strong>: </td>
    <td width="50%" valign="top"><input name="nome" type="text" maxlength="50" /></td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>CODICE FISCALE</strong>: </td>
    <td width="50%" valign="top"><input name="codfisc" type="text" maxlength="16" size="18" /></td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>CELLULARE</strong>: </td>
    <td width="50%" valign="top"><input name="cell" type="text" maxlength="10" size="10" /></td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>E-MAIL</strong>: </td>
    <td width="50%" valign="top"><input name="email" type="text" maxlength="50" /></td>
  </tr>
 </table>
<h3>Dati Veicolo</h3>
 <table>
  <tr>
    <td width="50%" valign="top"><strong>TARGA</strong>: </td>
    <td width="50%" valign="top"><input name="targa" type="text" maxlength="50" /></td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>TIPO VEICOLO</strong>: </td>
    <td width="50%" valign="top"><select name="veicolo">  <option selected="selected"> </option>
    <option>Autovettura</option>    <option>Autocarro &lt; 2500 Kg.</option>    <option>Motoveicolo</option></select>    </td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>MASSA COMPLESSIVA</strong>: </td>
    <td width="50%" valign="top"><input name="massa" type="text" maxlength="50" /></td>
  </tr>
  <tr>
    <td width="50%" valign="top"><strong>CILINDRATA</strong>: </td>
    <td width="50%" valign="top"><input name="cilindrata" type="text" maxlength="50" /></td>
  </tr>
 </table>
<br />
<input type="submit" value="INVIA" name="invia" />  <input type="reset" value="Cancella" />
</p>
</fieldset>
</form>
Top
Profilo Invia messaggio privato HomePage AIM Yahoo MSN
Nik
Semidio
Semidio


Registrato: 29/10/05 19:44
Messaggi: 204
Residenza: Grosseto - Maremma

MessaggioInviato: 28 Feb 2008 01:45    Oggetto: Rispondi

risolto eliminando l'enctype della form! Shocked
Top
Profilo Invia messaggio privato HomePage AIM Yahoo MSN
Mostra prima i messaggi di:   
Nuovo argomento   Rispondi    Indice del forum -> Linguaggi per Internet Tutti i fusi orari sono GMT + 2 ore
Pagina 1 di 1

 
Vai a:  
Non puoi inserire nuovi argomenti
Non puoi rispondere a nessun argomento
Non puoi modificare i tuoi messaggi
Non puoi cancellare i tuoi messaggi
Non puoi votare nei sondaggi