0

How can i upload an image in my php comment box here it is:

<?php


$act = $_POST['act'];
if($act == "post") {
    $name = $_POST 
['name'];
    $area  = $_POST ['area'];
    @$fp = fopen("comments.php", 'a');
    if (!$fp) {
        //The file could not be opened
        echo "There was an error! Please try again later!";
        exit;
    } else {
        //The file was successfully opened, lets write the comment to it.
              date_default_timezone_set('Europe/Paris');
setlocale (LC_ALL, "fr_FR"); 


              $outputstring = "</br><b>" .$name. " </b> le ".strftime('%A %e %B %Y ')." a ".strftime('%H:%M')." a ecris:<hr/>" .$area. "</br>" ;


        //Write to the file
        fwrite($fp, $outputstring, strlen($outputstring));

        //We are finished writing, close the file for security / memory management purposes
        fclose($fp);

        //Post the success message
        header('Location: Article1.php');   
    }
} else {
    //We are not trying to post a comment, show the form.
?>
<hr/>
<p>commentaires:</p>
<?php include("comments.php"); ?>
<br><br>
<hr/>
<p>Envoyez un commentaire:</p>

<form action="Article1.php" method="post">

    <table>

        <tr>
            <td>Name:</td>
            <td><input type="text"  name="name" style="font-family:arial; font-size = 12pt" value=""></input></td>
        </tr>
        <tr>
            <td>Comment:</td>

            <td>
<INPUT TYPE="button" NAME="insert" VALUE="Gras" onClick="this.form.area.value=this.form.area.value.concat('<b>Ajouter votre texte en gras ici</b>');">
<INPUT TYPE="button" NAME="insert" VALUE="Souligner" onClick="this.form.area.value=this.form.area.value.concat('<u>Ajouter votre texte soulignes ici </u>');">
<INPUT TYPE="button" NAME="insert" VALUE="italique" onClick="this.form.area.value=this.form.area.value.concat('<i>Ajouter votre texte en italique ici </i>');">
<INPUT TYPE="button" NAME="insert" VALUE="lien" onClick="this.form.area.value=this.form.area.value.concat('<a href=Ajouter le lien ici>Ajouter le nom de votre lien ici</a>');">
</br>
<INPUT TYPE="button" NAME="insert" VALUE="Image" onClick="this.form.area.value=this.form.area.value.concat('<img src=Ajouter le lien de votre image ici, ne choisisez pas une image gigantesque>');">
<INPUT TYPE="button" NAME="insert" VALUE="Centrer" onClick="this.form.area.value=this.form.area.value.concat('<center>Ajouter le texte ou image que vous volez centrer ici</center>');">
<INPUT TYPE="button" NAME="insert" VALUE="Nouvelle ligne" onClick="this.form.area.value=this.form.area.value.concat('</br>');">
</br>
<INPUT TYPE="button" NAME="insert" VALUE="Ork enerver!!!!!!!" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://www.pixeljoint.com/files/icons/full/orko_final.gif>');">
<INPUT TYPE="button" NAME="insert" VALUE="Bad moonz" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://wh40k.lexicanum.com/mediawiki/images/c/cb/Bad_Moon_Clan_banner.jpg>');">
<INPUT TYPE="button" NAME="insert" VALUE=":)" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://smileys.on-my-web.com/repository/Fantasy/fantasy-35.gif>');">
</br>
<INPUT TYPE="button" NAME="insert" VALUE=":|" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://www.naglfar.de/images/smileys/goblinboese.gif>');">
<INPUT TYPE="button" NAME="insert" VALUE=":-P" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://www.naglfar.de/images/smileys/goblinfrech.gif>');">
<INPUT TYPE="button" NAME="insert" VALUE="lol" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://www.naglfar.de/images/smileys/ork2.gif>');">
<INPUT TYPE="button" NAME="insert" VALUE="?" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://www.naglfar.de/images/smileys/ogerverwirrt.gif>');">
<INPUT TYPE="button" NAME="insert" VALUE=";)" onClick="this.form.area.value=this.form.area.value.concat('<img src=http://www.naglfar.de/images/smileys/orczwinker.gif>');">


</br>
<textarea name="area"  style="font-family:arial; font-size = 12pt" rows = "8" cols = "30" wrap="hard"></textarea><br>


</td>

        </tr>
    </table>
    <input type="hidden" name="act" value="post"></input>
    <input type="submit" name="submit" value="Envoyez"></input>
</form>



<?php
}
?>

Sanchixx

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.