<?
if($vis == "opret"){
echo "<form action=\\"index.php?vis=opret&opret=do\\" method=\\"post\\">
<table width=\\"620\\" border=\\"0\\" cellpadding=\\"2\\" cellspacing=\\"0\\">
<tr>
<td colspan=\\"2\\" class=\\"top\\"><div align=\\"center\\">Opret en ny bruger </div></td>
</tr>
<tr>
<td width=\\"250\\" class=\\"v\\"> </td>
<td width=\\"362\\" class=\\"h\\"> </td>
</tr>
<tr>
<td class=\\"v\\"><strong>Alder:</strong></td>
<td class=\\"h\\"><input name=\\"alder\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<tr>
<td class=\\"v\\"><strong>Køn:</strong></td>
<td class=\\"h\\"><select name=\\"køn\\" class=\\"plugin\\">
<option>Super Mand</option>
<option>Dreng</option>
<option>Bqsrøv</option>
<option>Møgunge</option>
<option>Super Kvinde</option>
<option>Tqs</option>
<option>Lebbe</option>
<option>Kælling</option>
</select></td>
</tr>
<td class=\\"v\\"></td> </td>
<td class=\\"h\\"> </td>
</tr>
<tr>
<td class=\\"v\\"><strong>Land:</strong></td>
<td class=\\"h\\"><input name=\\"land\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"><strong>By: </strong></td>
<td class=\\"h\\"><input name=\\"by\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"> </td>
<td class=\\"h\\"> </td>
</tr>
<tr>
<td class=\\"v\\"><strong>Email:</strong></td>
<td class=\\"h\\"><input name=\\"email\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"><strong>MSN:</strong></td>
<td class=\\"h\\"><input name=\\"msn\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"><strong>ICQ:</strong></td>
<td class=\\"h\\"><input name=\\"icq\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"> </td>
<td class=\\"h\\"> </td>
</tr>
<tr>
<td class=\\"v\\"><strong>Brugernavn:</strong></td>
<td class=\\"h\\"><input name=\\"brugernavn\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"><strong>Password</strong></td>
<td class=\\"h\\"><input name=\\"password\\" type=\\"text\\" size=\\"40\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"v\\"> </td>
<td class=\\"h\\"> </td>
</tr>
<tr>
<td valign=\\"top\\" class=\\"v\\"><strong>Kommentar:</strong></td>
<td class=\\"h\\"><textarea name=\\"kommentar\\" cols=\\"50\\" rows=\\"10\\" class=\\"plugin\\"></textarea></td>
</tr>
<tr>
<td class=\\"v\\"> </td>
<td class=\\"h\\"> </td>
</tr>
<tr>
<td class=\\"v\\"> </td>
<td class=\\"h\\"><input name=\\"submit\\" type=\\"submit\\" value=\\"Opret bruger\\" class=\\"plugin\\"></td>
</tr>
<tr>
<td class=\\"bv\\"> </td>
<td class=\\"bh\\"> </td>
</tr>
</table>
</form>";
}
elseif($opret == "do"){
$dato = date("d/n-y");
$_POST['kommentar'] = str_replace("\\n", "<br>", $_POST['kommentar']);
$tilfoj_nyhed = mysql_query("insert into zombie_nyheder (alder, køn, land, email, msn, icq, brugernavn, password, kommentar, login) values ('$_SESSION[alder]', '$_POST[køn]', '$_POST[land]', '$_POST[by]', '$_POST[email]', '$_POST[msn]', '$_POST[icq]', '$_POST[brugernavn]', '$_POST[password]', '$_POST[kommentar]', '$dato')") or die(mysql_error());
echo "<div align=\\"center\\">Din bruger er nu oprettet, du kan logge ind i siden!</div>";
}
?>
Overstående kode bliver includeret i index via if($vis == "opret"){ include "opret.php"; } og selve opret formularen virker fint, nu kommer fejlen:
Hvordan kan det være at elseif($opret == "do"){ ikke virker? den opretter ikke det i tabellen :\
på Forhånd tak, har desværre ikke nogen points at gi ud af :\