This is my formin HTML:
html (part of it)
<form name="annonserasteg3" method="post" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="lan" value="<?=$lan?>">
<input type="hidden" name="ort" value="<?=$ort?>">
<input type="hidden" name="kategori" value="<?=$kategori?>">
<input type="hidden" name="annonstyp" value="<?=$annonstyp?>">
<input type="hidden" name="formu" value="postad">
<table border="0" cellpadding="4">
<tr>
<th align="right"><font size="2"> Fullständigt namn:</font></th>
<td><input type="text" name="namn" size="20" maxlength="35" value="<?=$namn?>"></td>
</tr>
<tr>
<th align="right"><font size="2"> E-post:</font></th>
<td><input type="text" name="epost" size="20" maxlength="45" value="<?=$epost?>"></td>
</tr>
<tr>
<th align="right"><font size="2"> Telefon:</font></th>
<td><input type="text" name="tel" size="20" maxlength="20" value="<?=$tel?>">
<input type="checkbox" name="visatel" value="1"><font size="2">Visa mitt nummer.</font></td>
</tr>
<tr>
<th align="right"><font size="2"> Rubrik:</font></th>
<td><input type="text" name="rubrik" size="20" maxlength="35" value="<?=$rubrik?>"></td>
</tr>
<tr>
<th align="right"><font size="2"> Annonstext:</font></th>
<td><textarea name="annonstext" cols="35" rows="6"><?=$annonstext?></textarea></td>
</tr>
<tr>
<th align="right"><font size="2">Länk:</font></th>
<td><input type="text" name="lank" size="20" maxlength="50" value="<?=$lank?>"></td>
</tr>
<tr>
<th align="right"><font size="2">Länktitel:</font></th>
<td><input type="text" name="lanktitel" size="20" maxlength="30" value="<?=$lanktitel?>"></td>
</tr>
<tr>
<th align="right"><font size="2">Ladda upp en bild (GIF eller JPEG, max 50kb):</font></th>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="70000">
<input type=file name="userfile" size=20 value="<?=$file?>"></td>
</tr>
<tr>
<td><pre></pre></td>
<td><font size="2"><br> Uppgifterna är obligatoriska</font></td>
</tr>
<tr>
<td></td>
<td><pre> <input type="image" name="annonsera3" value="postat" src="annons/stegra.gif"></pre></td>
</tr>
</table>
</form>
The problem is the textarea. Everything is working fine otherwise.
In the beginning of the file I have this php code:
php
<?php
if ($formu) {
$emailpattern=".+@.+\..+";
$namn=$_POST['namn'];
$epost=$_POST['epost'];
$visatel=$_POST['visatel'];
$tel=$_POST['tel'];
$rubrik=$_POST['rubrik'];
$annonstext=$_POST['annonstext'];
$lank=$_POST['lank'];
$lanktitel=$_POST['lanktitel'];
$userfile=$_POST['userfile'];
if (($namn=='') OR ($tel=='') OR ($epost=='') OR ($rubrik=='') OR ($annonstext=='')) {
$error=1;
} elseif (($lank=='') AND ($lanktitel!='')) {
$error=2;
} elseif (($lank!='') AND ($lanktitel=='')) {
$error=3;
} elseif (!(eregi($emailpattern, $epost))) {
$error=4;
} elseif (($namn!='') AND ($tel!='') AND ($epost!='') AND ($rubrik!='') AND ($annonstext!='') AND (eregi($emailpattern, $epost))) {
header ("Location: annonsera4.php?lan=$lan&ort=$ort&annonstyp=$annonstyp&kategori=$kategori&namn=$namn&epost=$epost&tel=$tel&visatel=$visatel&rubrik=$rubrik&annonstext=$annonstext&lank=$lank&lanktitel=$lanktitel&file=$file");
exit;
}
}
The script sends me to another page if everything is filled in in correctly in the form. If not the form will be shown again with some warningmessages.
Now to the problem:
If a fill in one sentence the whole text will be shown later. If I fill in two rows in the textarea like this:
"Hi,
My name is Martin"
only "Hi," is shown in the output.
If I fill in:
"Hi,
My name is martin
and I like fish
or something else"
In that case the script gives me an internal error and no text is sent away to the another file what so ever.
I hope this clear it up a little bit, guys.