Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
727 views
in Technique[技术] by (71.8m points)

html - Textarea value not getting posted with form

I'm trying to input a textarea tag when I submit my form:

<textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText" form="confirmationForm"></textarea>

<form action="sendConfirmation.php" name="confirmationForm" method="post">
   <input type="submit" value="Email" class="submitButton">
</form>

As you can see I've set the form="confirmationForm" attribute in my textarea tag. I've used Live HTTP Headers to catch the POST request and it is empty (so I know the problem is not in sendConfirmation.php, the problem is that the confirmationText is not being POSTed). I've searched the net and as far as I can see I've set it correctly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

try to put it inside the form tag as follows... it should work

<form action="sendConfirmation.php" name="confirmationForm" method="post">
    <textarea id="confirmationText" class="text" cols="86" rows ="20" name="confirmationText"></textarea>

   <input type="submit" value="Email" class="submitButton">
</form>

however you can use the same approach as well but you need to provide the from id attribute then

<form action="sendConfirmation.php" id="confirmationForm" method="post">
   <input type="submit" value="Email" class="submitButton">
</form>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...