javascript/ innerhtml

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.

Related Question javascript - passing a string to innerHTML JavaScript using innerHTML and dynamic value passing to innerHTML innerHTML isn't passing to JavaScript passing javascript innerhtml variable to php Passing a JavaScript variable to fill innerHTML Passing data using HTML tags and innerHTML, setAttribute(), etc. Editing and updating news articles stored in a database Javascript - passing anchor into a span from .innerHTML Passing dynamic parameter to a JavaScript function using innerHTML Javascript - Passing a script to innerHTML on older browsers Passing database data from PHP to JavaScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM