Salve, ho bisogno di aiuto per un form che non riesco a creare!
Ho a disposizione il file viaggi.html:
Codice HTML:
<div id="content">
<h2>Racontate i vostri viaggi</h2>
<p>In questa sezione potrete raccontarci i vostri viaggi.</p>
<p> </p>
<form name="viaggi" method="post" ACTION="file.php">
<div class="form_description">
<h2>I vostri viaggi</h2>
<p>Descriveteceli...</p>
<label class="description" for="element_1">Titolo
<input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value=""/>
</label>
<div>
<p>Luogo
<select class="element select medium" id="element_8" name="element_8">
<option value="" selected="selected"></option>
<option value="1" >Italia</option>
<option value="2" >Europa</option>
<option value="3" >America del Nord</option>
<option value="4" >America del Sud</option>
<option value="5" >Australia</option>
<option value="6" >Asia</option>
</select>
</p>
<div></div>
<label class="description" for="element_2">Data del Viaggio </label>
<span>
<input id="element_2_1" name="element_2_1" class="element text" size="2" maxlength="2" value="" type="text"> /
<label for="element_2_1">MM</label>
</span>
<span>
<input id="element_2_2" name="element_2_2" class="element text" size="2" maxlength="2" value="" type="text"> /
<label for="element_2_2">DD</label>
</span>
<span>
<input id="element_2_3" name="element_2_3" class="element text" size="4" maxlength="4" value="" type="text">
<label for="element_2_3">YYYY</label>
</span>
<label class="description" for="element_3"><br />
Costo </label>
<span class="symbol">€</span>
<span>
<input id="element_3_1" name="element_3_1" class="element text currency" size="10" value="" type="text" /> .
<label for="element_3_1">Euros</label>
</span>
<span>
<input id="element_3_2" name="element_3_2" class="element text" size="2" maxlength="2" value="" type="text" />
<label for="element_3_2">Cents</label>
</span>
<label class="description" for="element_4">Descrizione </label>
<div>
<textarea id="element_4" name="element_4" class="element textarea medium"></textarea>
</div>
<label class="description" for="element_5">Immagini </label>
<div>
<input id="element_5" name="element_5" class="element file" type="file"/>
</div>
<label class="description" for="element_6"> </label>
<div>
<input id="element_6" name="element_6" class="element file" type="file"/>
</div>
<label class="description" for="element_7"> </label>
<div>
<input id="element_7" name="element_7" class="element file" type="file"/>
</div>
<input type="hidden" name="form_id" value="118589" />
<input id="saveForm" class="button_text" type="submit" name="submit" value="Invia" />
</div>
</form>
</div>
Questo invece è il file file.php:
Codice PHP:
<?php
$db = "database.txt"; // in questo file verranno salvati i dati.
$fp = fopen($db, "a+");
fwrite($fp, $_POST["element_1"] . " | " . $_POST["element_8"] . " | " . $_POST["element_2"] . " |
" . $_POST["element_2_1"] . " | " . $_POST["element_2_2"] . " | " . $_POST["element_2_3"] . " |
" . $_POST["element_3"] . " | " . $_POST["element_3_1"] . " | " . $_POST["element_3_2] . " |
" . $_POST["element_4"] . " | " . $_POST["element_5"] . " | " . $_POST["element_6"] . " |
" . $_POST["element_7"] . ); // salvo i dati nel file
fclose($fp);
?>
Ma qualcosa non funziona e mi dà questo errore:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in D:\Inetpub\webs\viaggimiraggiit\file.php on line 8
Cosa può essere??
Grazie in anticipo!