Hallo allemaal,
Omdat ik er zelf niet uitkom zal ik mijn probleem hier zo duidelijk mogelijk proberen uit te leggen:
Ik heb een script gemaakt waarmee je een bericht in de database kan zetten, echter wordt er niks in de database gezet én komen de foutmeldingen vóór het submitten van het formulier.
Dit is mijn script:
Degene die mij de juiste oplossing weet te vertellen krijgt van mij 0.1pt!
Alvast bedankt allemaal,
Gr. Jos
Omdat ik er zelf niet uitkom zal ik mijn probleem hier zo duidelijk mogelijk proberen uit te leggen:
Ik heb een script gemaakt waarmee je een bericht in de database kan zetten, echter wordt er niks in de database gezet én komen de foutmeldingen vóór het submitten van het formulier.
Dit is mijn script:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"config.php"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/ob_start"]ob_start[/URL][COLOR= #007700]();[/COLOR]
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MijnSexyFoto</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="header"><div id="login">
<form action="" method="post">
<input type="text" border="0" class="login_input" name="naam" value="Gebruikersnaam" onBlur="if(this.value == ) { this.value=Gebruikersnaam}"
onfocus="if (this.value == Gebruikersnaam){this.value=}" />
<input type="password" border="0" class="login_input2" name="pass" value="mijnwachtwoord" onBlur="if(this.value == ) { this.value=mijnwachtwoord}"
onfocus="if (this.value == mijnwachtwoord){this.value=}" />
<input type="submit" class="login_submit" border="0" value="." />
</form>
</div></div>
<div id="menu"> <a href="#">Startpagina</a>
<a href="#">Registreren</a>
<a href="#">Fotos</a>
<a href="#">Leden</a>
<a href="#">Tell-a-friend</a>
<a href="#">Bookmark</a>
<a href="#">Info</a>
<a href="#">Contactformulier</a>
</div>
[COLOR= #0000BB]<?php
$bQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT aan FROM berichten WHERE aan="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$bAantal[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$bQuery[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$bTotaal[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$bAantal[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]])){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000][/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]<div id="leden_menu">
<div class="bericht"></div> Berichten <strong>([/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$bAantal[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000])</strong>
</div>[/COLOR][COLOR= #007700];
}[/COLOR]
?>
<div class="container">
<div class="content-top">Controlepaneel</div>
<div class="content-mid">
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div class="fout">Je bent niet ingelogged.<br /></div>[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]"
<form action="" method="post">
<input type="text" border="0" class="login_input" name="aan" value="Aan" onBlur="if(this.value == ) { this.value=Aan}"
onfocus="if (this.value == Aan){this.value=}" />
<input type="text" border="0" class="login_input" name="bericht" value="Bericht" onBlur="if(this.value == ) { this.value=Bericht}"
onfocus="if (this.value == Bericht){this.value=}" />
<input type="submit" border="0" value="Verstuur bericht" />
</form>"[/COLOR][COLOR= #007700];
}[/COLOR]
?>
<div class="fout">
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aan[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"Aan"[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Je hebt geen ontvanger ingevuld.<br />[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]"Bericht"[/COLOR][COLOR= #007700]){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Je hebt geen bericht ingevuld.[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO `berichten` (aan,inhoud,datum) VALUES (
"[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]aan[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
"[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]bericht[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]",
NOW()
)
"[/COLOR][COLOR= #007700])){[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Je bericht is succesvol verstuurd![/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL][COLOR= #DD0000]Je bericht is niet verzonden, probeer het later nog eens.[/COLOR][COLOR= #007700];
}
}[/COLOR]
?>
</div>
</div>
<div class="content-bottom"></div>
<div id="copyright">© Copyright MijnSexyFoto 2010-2011 | Alle rechten voorbehouden</div>
</div>
</body>
</html> Degene die mij de juiste oplossing weet te vertellen krijgt van mij 0.1pt!

Alvast bedankt allemaal,
Gr. Jos

?

