unexpected T_ELSE

Gestart doorOne2xs42 reacties71 weergaven

43 berichten · pagina 3 van 3

One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
Wat heb je dan geprobeerd? Laat je code eens zien? Kijk overigens ook eens naar mijn tips en adviezen!
Spoiler tonen
<h1>Post an idea</h1>
[COLOR= #0000BB]<?php[/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/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
 
[COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]));[/COLOR] 
[COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] 
[COLOR= #0000BB]$picture[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]picture[/COLOR][COLOR= #007700]]));[/COLOR] 
[COLOR= #0000BB]$idea[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]idea[/COLOR][COLOR= #007700]]));[/COLOR] 

[COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

[COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your name is too short.<br />[/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

[COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your email is too short.<br />[/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #007700]![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])){[/COLOR]

[COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Fill in a valid email.<br />[/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$idea[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]){[/COLOR]

[COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your idea must be at least 50 characters long.<br />[/COLOR][COLOR= #007700];

}[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]){[/COLOR]

[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000][/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
 
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO idea (name, email, picture, idea) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/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]$email[/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]$picture[/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]$idea[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] 
 
[URL="http://www.php.net/print"]print[/URL] [COLOR= #DD0000]"Your idea has been successfully posted."[/COLOR][COLOR= #007700]; 
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
  [COLOR= #007700]{[/COLOR]
  ?>
<form action=" ?p=post " method="POST">
Name: <br><input type="text" name="name"><br /> 
Email: <br><input type="text" name="email"><br /> 
Link to image: <a href="http://upload.ideapedia.eu/" target="_blank"><small>Upload image</small></a> <br><input type="text" name="picture"><br />
Idea: <br><textarea name="idea" rows="10" cols="50"></textarea><br /> 
<input type="submit" name="verzenden" value="Post idea"> 
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR] 
?>
Lennard schreef:
Eerdere citaten tonen
Jellesch schreef:
Eerdere citaten tonen
Aarclay schreef:
Wat heb je al geprobeerd? Ik heb al tips en advies gegeven, maar het lijkt wel alsof je het echt kant-en-klaar zoals nummer 43 van de Chinees wilt, en dat is niet echt de bedoeling.
Ik begrijp dat if - elseif - elseif - else toepassing niet, ik heb dat geprobeerd maar blijkbaar niet op de goede manier. Daarom vraag ik of jij het wilt toepassen in mijn script dat ik dat kan doorkijken en ervan kan leren.
Ga dan eerst eens met een simpel scriptje prutsen en kijken wat if, elseif en else precies doen en waarom je niet 2x else kan doen.
ga ik doen smile
Aarclay schreef:
Er staat niets anders dan:
als (....), doe dan dat
anders als (....), doe dan dat,
anders als (....), doe dan dat,
anders als (....), doe dan dat,
anders als (....), doe dan dat,
anders als (....), doe dan dat,
en anders....., doe dan dit
oke wink
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
En waar is mijn TAB-advies? Die heb je niet toegepast!
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
En waar is mijn TAB-advies? Die heb je niet toegepast!
Nee, sorry, ik heb niet zon hele handige editor voor de mac, weet jij misschien een goede?
0
Berichten
788
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
En waar is mijn TAB-advies? Die heb je niet toegepast!
Jellesch schreef:
Eerdere citaten tonen
Aarclay schreef:
En waar is mijn TAB-advies? Die heb je niet toegepast!
Nee, sorry, ik heb niet zon hele handige editor voor de mac, weet jij misschien een goede?
Notepad++ gebruik ik zelf.
0
Berichten
190
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
worshippy Netbeans worshippy
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Superhosting schreef:
worshippy Netbeans worshippy
Probleem ??

toevoeging op 7 januari 2013, 20:28:07:

<h1>Post an idea</h1>
[COLOR= #0000BB]<?php[/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/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$picture[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]picture[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$idea[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]idea[/COLOR][COLOR= #007700]]));[/COLOR] 

    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

        [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your name is too short.<br />[/COLOR][COLOR= #007700];

            }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

            [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your email is too short.<br />[/COLOR][COLOR= #007700];

                }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #007700]![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])){[/COLOR]

                [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Fill in a valid email.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$idea[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]){[/COLOR]

                    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your idea must be at least 50 characters long.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]){[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000][/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
 
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO idea (name, email, picture, idea) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/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]$email[/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]$picture[/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]$idea[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] 
 
[URL="http://www.php.net/print"]print[/URL] [COLOR= #DD0000]"Your idea has been successfully posted."[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
  ?>
<form action=" ?p=post " method="POST">
Name: <br><input type="text" name="name"><br /> 
Email: <br><input type="text" name="email"><br /> 
Link to image: <a href="http://upload.ideapedia.eu/" target="_blank"><small>Upload image</small></a> <br><input type="text" name="picture"><br />
Idea: <br><textarea name="idea" rows="10" cols="50"></textarea><br /> 
<input type="submit" name="verzenden" value="Post idea"> 
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR] 
?>


zoiets beter? uitlijning smile
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Jellesch schreef:
Eerdere citaten tonen
Superhosting schreef:
worshippy Netbeans worshippy
Probleem ??

toevoeging op 7 januari 2013, 20:28:07:

<h1>Post an idea</h1>
[COLOR= #0000BB]<?php[/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/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$picture[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]picture[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$idea[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]idea[/COLOR][COLOR= #007700]]));[/COLOR] 

    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

        [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your name is too short.<br />[/COLOR][COLOR= #007700];

            }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

            [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your email is too short.<br />[/COLOR][COLOR= #007700];

                }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #007700]![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])){[/COLOR]

                [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Fill in a valid email.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$idea[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]){[/COLOR]

                    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your idea must be at least 50 characters long.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]){[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000][/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
 
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO idea (name, email, picture, idea) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/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]$email[/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]$picture[/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]$idea[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] 
 
[URL="http://www.php.net/print"]print[/URL] [COLOR= #DD0000]"Your idea has been successfully posted."[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
  ?>
<form action=" ?p=post " method="POST">
Name: <br><input type="text" name="name"><br /> 
Email: <br><input type="text" name="email"><br /> 
Link to image: <a href="http://upload.ideapedia.eu/" target="_blank"><small>Upload image</small></a> <br><input type="text" name="picture"><br />
Idea: <br><textarea name="idea" rows="10" cols="50"></textarea><br /> 
<input type="submit" name="verzenden" value="Post idea"> 
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR] 
?>


zoiets beter? uitlijning smile
Je snapt die smilie toch wel wink
Die addslashes() mag je er ook wel uit gooien zie ik.
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
Eerdere citaten tonen
Jellesch schreef:
Eerdere citaten tonen
Superhosting schreef:
worshippy Netbeans worshippy
Probleem ??

toevoeging op 7 januari 2013, 20:28:07:

<h1>Post an idea</h1>
[COLOR= #0000BB]<?php[/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/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$picture[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]picture[/COLOR][COLOR= #007700]]));[/COLOR] 
    [COLOR= #0000BB]$idea[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/addslashes"]addslashes[/URL][COLOR= #007700]([/COLOR]htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]idea[/COLOR][COLOR= #007700]]));[/COLOR] 

    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

        [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your name is too short.<br />[/COLOR][COLOR= #007700];

            }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

            [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your email is too short.<br />[/COLOR][COLOR= #007700];

                }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #007700]![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])){[/COLOR]

                [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Fill in a valid email.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$idea[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]){[/COLOR]

                    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your idea must be at least 50 characters long.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]){[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000][/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
 
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO idea (name, email, picture, idea) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/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]$email[/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]$picture[/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]$idea[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] 
 
[URL="http://www.php.net/print"]print[/URL] [COLOR= #DD0000]"Your idea has been successfully posted."[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
  ?>
<form action=" ?p=post " method="POST">
Name: <br><input type="text" name="name"><br /> 
Email: <br><input type="text" name="email"><br /> 
Link to image: <a href="http://upload.ideapedia.eu/" target="_blank"><small>Upload image</small></a> <br><input type="text" name="picture"><br />
Idea: <br><textarea name="idea" rows="10" cols="50"></textarea><br /> 
<input type="submit" name="verzenden" value="Post idea"> 
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR] 
?>


zoiets beter? uitlijning smile
Je snapt die smilie toch wel wink
Die addslashes() mag je er ook wel uit gooien zie ik.
oke

<h1>Post an idea</h1>
[COLOR= #0000BB]<?php[/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/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]);[/COLOR] 
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]);[/COLOR] 
    [COLOR= #0000BB]$picture[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]picture[/COLOR][COLOR= #007700]]);[/COLOR] 
    [COLOR= #0000BB]$idea[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]idea[/COLOR][COLOR= #007700]]);[/COLOR] 

    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

        [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your name is too short.<br />[/COLOR][COLOR= #007700];

            }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]

            [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your email is too short.<br />[/COLOR][COLOR= #007700];

                }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #007700]![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])){[/COLOR]

                [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Fill in a valid email.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$idea[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]){[/COLOR]

                    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].=[/COLOR]  [COLOR= #DD0000]Your idea must be at least 50 characters long.<br />[/COLOR][COLOR= #007700];

                    }[/COLOR]

        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]!=[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700]){[/COLOR]

    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000][/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700];

}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
 
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO idea (name, email, picture, idea) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/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]$email[/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]$picture[/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]$idea[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR] 
 
[URL="http://www.php.net/print"]print[/URL] [COLOR= #DD0000]"Your idea has been successfully posted."[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL]
    [COLOR= #007700]{[/COLOR]
  ?>
<form action=" ?p=post " method="POST">
Name: <br><input type="text" name="name"><br /> 
Email: <br><input type="text" name="email"><br /> 
Link to image: <a href="http://upload.ideapedia.eu/" target="_blank"><small>Upload image</small></a> <br><input type="text" name="picture"><br />
Idea: <br><textarea name="idea" rows="10" cols="50"></textarea><br /> 
<input type="submit" name="verzenden" value="Post idea"> 
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR] 
?>
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
En, werkt dat?
0
One2xs

Bot · Topicstarter

Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
En, werkt dat?
nee, die else heeft nog steeds een fout. ik begrijp het gewoon niet sadley
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ik zie nog steeds twee elses na elkaar, en dat kan niet.

toevoeging op 7 januari 2013, 20:45:46:
Vooruit, een kewstie van logisch kijken is niet zo lastig. Gewoon kijken bij welke voorwaarde de if-elseif-else hoort. Maar goed, ik heb de editor er bij gepakt, en de boel opgeschmukt.

<h1>Post an idea</h1>
[COLOR= #0000BB]<?php[/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/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]) {[/COLOR]
    [COLOR= #0000BB]$name[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]name[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$email[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$picture[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]picture[/COLOR][COLOR= #007700]]);[/COLOR]
    [COLOR= #0000BB]$idea[/COLOR] [COLOR= #007700]=[/COLOR] htmlspecialchars[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]idea[/COLOR][COLOR= #007700]]);[/COLOR]

    [COLOR= #0000BB]$errors[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]

    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][]=[/COLOR][COLOR= #DD0000]Your name is too short.[/COLOR][COLOR= #007700];
    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$email[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]5[/COLOR][COLOR= #007700]){[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][]=[/COLOR][COLOR= #DD0000]Your email is too short.[/COLOR][COLOR= #007700];
    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]@[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])[/COLOR] or [COLOR= #007700]![/COLOR][URL="http://www.php.net/strstr"]strstr[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000].[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$email[/COLOR][COLOR= #007700])){[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][]=[/COLOR][COLOR= #DD0000]Fill in a valid email.[/COLOR][COLOR= #007700];
    }[/COLOR][URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$idea[/COLOR][COLOR= #007700]) <[/COLOR] [COLOR= #0000BB]50[/COLOR][COLOR= #007700]){[/COLOR]
        [COLOR= #0000BB]$errors[/COLOR][COLOR= #007700][]=[/COLOR][COLOR= #DD0000]Your idea must be at least 50 characters long.[/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/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$errors[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]) {[/COLOR]
            [COLOR= #0000BB]$result[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO idea (name, email, picture, idea) VALUES ("[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$name[/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]$email[/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]$picture[/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]$idea[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]")"[/COLOR][COLOR= #007700]);[/COLOR] 
            [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Your idea has been successfully posted."[/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]"There is a problem.... "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]();
            }
        }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
            [COLOR= #FF8000]// hier mag je met foreach je $errors-array doorloopen.[/COLOR]
        [COLOR= #007700]}        
    }

}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
  ?>
<form action=" ?p=post " method="POST">
Name: <br><input type="text" name="name"><br />
Email: <br><input type="text" name="email"><br />
Link to image: <a href="http://upload.ideapedia.eu/" target="_blank"><small>Upload image</small></a> <br><input type="text" name="picture"><br />
Idea: <br><textarea name="idea" rows="10" cols="50"></textarea><br />
<input type="submit" name="verzenden" value="Post idea">
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR]
?>


Let wel op het commentaarblok.
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren