IF ???? ELSE
{
$fotourl = "<img src=\"$fotoinv\" width=\"100\">";
}
else
{
$fotourl = "";
}
Gewijzigd op 20/04/2004 21:14:00 door Mitch X
ik moet zorgen dat als er niks ingevuld wordt dat hij dan niks in de database schrijft
Sorry was intensief bezig met het probleem was vergeten er wat bij te schrijven
INSERT INTO tabel (kolom1, foto) VALUES ('$kolom1', '$_POST[fotoinv]')
Elwin
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?
echo "<body bgcolor='#000000' scrolling='no' topmargin='0'>";
include "connect.php";
$bericht = wordwrap(nl2br(htmlentities($bericht)), 60, "\n", 1);
$email = htmlentities($email);
$naam = htmlentities($naam);
$ip = $REMOTE_ADDR;
$date = date("d.m.Y [H:i]");
if ($_post["fotoinv"])
{
$fotourl = "<img src=\"$fotoinv\" width=\"100\">";
}
else
{
$fotourl = "";
}
if ($_POST["naam"]&& $_POST["email"] && $_POST["bericht"])
{
$sql = "INSERT INTO gastenboekmano (id, naam, email, bericht, ip, date, fotourl) VALUES ( '', '$naam', '$email', '$bericht', '$REMOTE_ADDR', '$date', '$fotourl')";
$res = mysql_query($sql)or die (mysql_error());
if ($res)
{
echo "<p><font size='2' color='#ffffff'><B>Uw bericht is toegevoegd. Druk <a href='guestbook.php' target='I2'>hier</a></b></font></p>";
}
else
{
echo "<font size='2' color='#ffffff'>Sorry niet toegevoegd. Er is iets misgegaan met het invoeren in de database.</font>";
}
}
else
{
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='443' height='225'>";
echo "<tr><td width='207' height='107'>";
echo "<form method='POST' action='$php_self'>";
echo "<p><font color='#0000FF' face='Verdana'> Naam:<br>";
echo "<input type='text' name='naam' size='30' style='border-style: dashed; border-width: 1' maxlength='30'></font></p>";
echo "<font color='#0000FF' face='Verdana'> Email:<br>";
echo "<input type='text' name='email' size='30' style='border-style: dashed; border-width: 1' maxlength='30'></font>";
if ($_POST["submit"])echo "<br><font size='1' color='#ffffff'>U ben één/meerdere veld(en) vergeten!</font><br>";
echo "<br><font color='#0000FF' face='Verdana'> Bericht:</font></td>";
echo "<td width='292' height='107'>";
echo "<iframe name='I1' width='266' height='140' marginwidth='1' marginheight='1' scrolling='no' border='0' frameborder='0' src='manolitobericht.html'>";
echo "Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>";
echo "</td></tr><tr>";
echo "<td width='443' colspan='2'>";
echo "<p><textarea rows='5' name='bericht' cols='50' style='border:3px double #0000FF;' maxlength='500'></textarea>";
echo "<input type='submit' value='Invoegen' name='submit' style='border: 3px double #0000FF; background-color: #3399FF'>";
echo "<input type='reset' value='Vernieuwen' name='reset' style='border: 3px double #0000FF; background-color: #3399FF'></font>";
echo "<font size='2' color='#0000FF' face='verdana'>Foto adres:<input type='text' name='fotoinv' size='23' style='border-style: dashed; border-width: 1'></font></p>";
echo "</form></td>";
echo "</tr></table></div>";
}
?>
echo "<body bgcolor='#000000' scrolling='no' topmargin='0'>";
include "connect.php";
$bericht = wordwrap(nl2br(htmlentities($bericht)), 60, "\n", 1);
$email = htmlentities($email);
$naam = htmlentities($naam);
$ip = $REMOTE_ADDR;
$date = date("d.m.Y [H:i]");
if ($_post["fotoinv"])
{
$fotourl = "<img src=\"$fotoinv\" width=\"100\">";
}
else
{
$fotourl = "";
}
if ($_POST["naam"]&& $_POST["email"] && $_POST["bericht"])
{
$sql = "INSERT INTO gastenboekmano (id, naam, email, bericht, ip, date, fotourl) VALUES ( '', '$naam', '$email', '$bericht', '$REMOTE_ADDR', '$date', '$fotourl')";
$res = mysql_query($sql)or die (mysql_error());
if ($res)
{
echo "<p><font size='2' color='#ffffff'><B>Uw bericht is toegevoegd. Druk <a href='guestbook.php' target='I2'>hier</a></b></font></p>";
}
else
{
echo "<font size='2' color='#ffffff'>Sorry niet toegevoegd. Er is iets misgegaan met het invoeren in de database.</font>";
}
}
else
{
echo "<div align='center'>";
echo "<table border='0' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#111111' width='443' height='225'>";
echo "<tr><td width='207' height='107'>";
echo "<form method='POST' action='$php_self'>";
echo "<p><font color='#0000FF' face='Verdana'> Naam:<br>";
echo "<input type='text' name='naam' size='30' style='border-style: dashed; border-width: 1' maxlength='30'></font></p>";
echo "<font color='#0000FF' face='Verdana'> Email:<br>";
echo "<input type='text' name='email' size='30' style='border-style: dashed; border-width: 1' maxlength='30'></font>";
if ($_POST["submit"])echo "<br><font size='1' color='#ffffff'>U ben één/meerdere veld(en) vergeten!</font><br>";
echo "<br><font color='#0000FF' face='Verdana'> Bericht:</font></td>";
echo "<td width='292' height='107'>";
echo "<iframe name='I1' width='266' height='140' marginwidth='1' marginheight='1' scrolling='no' border='0' frameborder='0' src='manolitobericht.html'>";
echo "Your browser does not support inline frames or is currently configured not to display inline frames.</iframe>";
echo "</td></tr><tr>";
echo "<td width='443' colspan='2'>";
echo "<p><textarea rows='5' name='bericht' cols='50' style='border:3px double #0000FF;' maxlength='500'></textarea>";
echo "<input type='submit' value='Invoegen' name='submit' style='border: 3px double #0000FF; background-color: #3399FF'>";
echo "<input type='reset' value='Vernieuwen' name='reset' style='border: 3px double #0000FF; background-color: #3399FF'></font>";
echo "<font size='2' color='#0000FF' face='verdana'>Foto adres:<input type='text' name='fotoinv' size='23' style='border-style: dashed; border-width: 1'></font></p>";
echo "</form></td>";
echo "</tr></table></div>";
}
?>
</body></html>
Quote:
De foto wordt er ook weer uit gehaald en dan moet ik geen <img src='$row['fotoinv']'> moet plaatsen anders laat hij dan altijd iets zien een kruisje of een plaatje
Dan doe je toch een hele simpele controle:
Elwin