0

I'm having trouble with posting values typed into textarea. everything else works well, any idea how to make it work?

HTML:

<form id="formData2" action="artistuploader.php" method="post" 
enctype="multipart/form-data">

        <input type="hidden" name="size" value="1000000"></input>
        <br/>
        <input id="inputField" type="text" name="actname" placeholder="Act Name" >
        <br>
        <input id="inputField" type="text" name="fullname" placeholder="Full Name" >
        <br>
        <input id="inputField" type="text" name="genre" placeholder="Genre" >
        <br>
        <textarea id="inputField" name="biography" form="formData2" placeholder="Biography"<?php echo $biography; ?>></textarea>
        <br>
        <input id="inputField" type="file" name="artistImage" placeholder="Artwork" >
        <br>
        <input id="inputField" type="text" name="imagepath" placeholder="Image path URL" >
        <br>
        <input id="submitButton" type="submit" name="uploadArtist" value="Register Artist">

    </form>

PHP

<?php

$msg = "";

//if Upload button is pressed
if (isset($_POST['uploadArtist'])){
    $target = "uploads/artistPics".basename($_FILES['artistImage']['name']);


    //connecting to our database
    $db = mysqli_connect("127.0.0.1", "user", "pass", "tablename");
    $tmp_name = $_FILES['artistImage']['tmp_name'];
    $name = $_FILES['artistImage']['name'];
    //getting the submitted form data
    $ActName = $_POST['actname'];
    $FullName = $_POST['fullname'];
    $Genre = $_POST['genre'];
    $ArtistPhoto = $_FILES['artistImage']['name'];
    $imageURLpath = $_POST['imagepath'];
    $Biography = $_POST['biography'];//having problem with this line here

    //saving submitted data into database table songsDB
    $sql = "INSERT INTO  artistsdb (ActName,FullName,Genre,ArtistPhoto,Biography,imageURLpath) VALUES ('$ActName','$FullName','$Genre','$ArtistPhoto','$Biography','$imageURLpath')";
    mysqli_query($db, $sql); //stores the submitted data into table

    //now moving the uploaded image to uploads folder
    if(move_uploaded_file($_FILES['artistImage']['tmp_name'], $target)){
        $msg = "Uploaded Successful";
    }else{
        $msg = "There was a problem uploading Data";
    }
}

//header("refresh:1; url=index.php"); ?>
Ahsan Ali
  • 4,951
  • 2
  • 17
  • 27

1 Answers1

0

Replace your textarea with

 <textarea id="inputField" name="biography" form="formData2" placeholder="Biography"><?php echo $biography; ?></textarea>
Ahsan Ali
  • 4,951
  • 2
  • 17
  • 27