Hello .
Im trying to submit a form that is inside a php while loop ( im using the loop to fitch data from the database , and depends on how many data that been fetched the from will be generated ) so if we have 4 rows from the data we will have 4 forms .

My problem is when i submit the first form it do submit perrty good , but when i try to submit anyother form it submit but the textarea keeps passing empty value , dont know whey .

I did cut only the form code cause my code is so long , im passing the values to another page using ajax .



    while($FR = $FetchReply->FETCH(PDO::FETCH_ASSOC))
        $user_id = $FR['replier_id'];
        $FetchReplyerInfo = $conn->prepare("SELECT * FROM users WHERE user_id = ?");
        $FRI = $FetchReplyerInfo->fetch(PDO::FETCH_ASSOC);
        $username = $FRI['username'];
            <form action="" method="POST" onsubmit="return SubmitComment('reply', <?php echo $FUI['user_id']; ?>, null, <?php echo $FC['id']; ?>);">
                <div class="form-group">
                    <textarea class="form-control" id="reply" rows="3" placeholder="* Your comment here" required></textarea>
                <button type="submit" class="btn btn-theme btn-md">Reply</button>
    } ?>


Edited by pritaeas: Fixed markdown.

11 Months
Discussion Span
Last Post by lps

This is due to during the looping, textarea with same id id="reply" created. Try change the id into class.

Votes + Comments
id and class do the same thing, but you can apply class to multiple elements
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.