
berichtenbalk
- binkkie
- Closed
-
-
-
ja doe ik ook maar het werkt toch niet
Nieuwe reactie samengevoegd met originele reactie op 09.04.11 18:58:49:
deze code werkt nietPHP
Toon Meer<?php include ("config.php"); if(isSet($_POST['post'])) { mysql_query("INSERT INTO berichtenbalk (username, bericht, ip) VALUES ('".$_SESSION['login']."','".$_POST['bericht']."','".$ip."')") or die(mysql_error()); echo "Je bericht is succesvol toegevoegd!"; echo "</marquee><br>"; echo "<a href=\"index.php\">Klik hier om terug te gaan!</a>"; } else { ?> <form action="" method="post" name="berichtenbalk"> <table width="90%" border="1" cellpadding="2" cellspacing="0" bordercolor="#999999" bgcolor="#CCCCCC"> <tr> <td colspan="3" height="25" background="img/toptabel2.gif">Plaats een bericht</td> </tr> <tr> <td width="263">Naam <input name="naam" type="text" maxlength="50"></td> <td width="334">Bericht <input name="bericht" type="text" maxlength="50"></td> <td width="83"> <input type="submit" name="post" value="Post bericht"></td> </tr> </table> </form> <?php } ?>
-
PHP
Toon Meer<?php include ("config.php"); if($_SESSION['login'] == ""){ echo "sessie login is leeg!"; exit; } if(isSet($_POST['post'])) { $ip = getenv('REMOTE_ADDR'); mysql_query("INSERT INTO `berichtenbalk` (username, bericht, ip) VALUES ('".$_SESSION['login']."','".$_POST['bericht']."','".$ip."')") or die(mysql_error()); echo "Je bericht is succesvol toegevoegd!"; echo "</marquee><br />"; echo "<a href=\"index.php\">Klik hier om terug te gaan!</a>"; } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="berichtenbalk"> <table width="90%" border="1" cellpadding="2" cellspacing="0" bordercolor="#999999" bgcolor="#CCCCCC"> <tr> <td colspan="3" height="25" background="img/toptabel2.gif">Plaats een bericht</td> </tr> <tr> <td width="263">Naam <input name="naam" type="text" value="<?php echo $_SESSION['login']; ?>" disabled="disabled" maxlength="50"></td> <td width="334">Bericht <input name="bericht" type="text" maxlength="50"></td> <td width="83"> <input type="submit" name="post" value="Post bericht"></td> </tr> </table> </form> <?php } ?>
werkt dit niet dan moet je maar eens iets anders gaan rippen.
wat wel direct werkt.
|-)|-) -
Joh.
Bij $_SESSION['login']
Moet Bij login het gene komen hoe de naam is bij het database..
[offtopic]Enig verstand van php oid...?[/offtopic]
-
Participate now!
Heb je nog geen account? Registreer je nu en word deel van onze community!