document.getElementById("message").innerHTML = 'choice 1: type="text" name="choice" value="">
Does anybody knows how to pass the name="choice" to database?
i got an undefined index choice error.
You are asking a huge question there but to try and help, the workflow might be:
1. post your data using ajax to a serverside handler
2. process and validate/sanitise the data and pass it to the database
3. once done return a confirmation (or error) message back tot he frontend
4. handle the ajax response and feedback to the user
here is some information about ajax , here's the php manual docs on pdo and mysql database functions and here is the docs for jquery which might make the ajax process a big easyer
Give the resources a read, have a go at implementing the functionality you need and if you get stuck post smaller, recreatable problems with the code you have written
You have to create form in you innreHTML. For ex, In your JavaScript,
var display="<form action='url' method='post'>"+
"<input type='text' name='Name'/>"+
"<input type='submit' name='Submit'/>"+
"</form>";
Then, you can add this text box value into database at another JSP page code by using JSTL tags.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.