redskin Posted December 22, 2008 Share Posted December 22, 2008 Hallo, Someone has made a form for me. This form has add row function. see the code pls. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Online membership</title> <link href="main.css" type="text/css" rel="stylesheet"> </head> <script> function add_formrow(){ if (!this.table_formcontainer) this.table_formcontainer = document.getElementById("table_formcontainer"); if (!this.table_formcontainer) return; var new_row = table_formcontainer.insertRow(-1); var new_cell1 = new_row.insertCell(0); var new_cell2 = new_row.insertCell(1); var new_cell3 = new_row.insertCell(2); var new_input1 = document.createElement("input"); new_input1.type = "text"; new_cell1.appendChild(new_input1); var new_input2 = document.createElement("input"); new_input2.type = "text"; new_cell2.appendChild(new_input2); var new_input3 = document.createElement("select"); new_input3.name="transport[]"; var options = ["No", "Bike", "Car", "Motorbike", "Public transport"]; for (var i = 0; i < options.length; i++) { var option = document.createElement("option"); option.value = options[i]; option.text= options[i]; try { new_input3.add(option, null); } catch(error) { new_input3.add(option); } } new_cell3.appendChild(new_input3); } </script> <body> <div id="credit"><b>T e s t</b></div> <br> <form method="post" action="" name="data"> <fieldset> <legend> <font color="blue"><b>Request</b></font></legend><br> <table id="table_formcontainer"> <tr> <td width="10">Name</td> <td>Age<td>Transport<td> </td> </td> </tr> </table> <table> <tr> <td width="500" align="right">[ b<a href="#" onclick='add_formrow();'>+</a> ]</td> </tr> <tr> <td width="10"><br><input type="submit" name="submit" value=" S e n d "> <td> </td> <td> </td> <td> </td></td> </tr> </table> </form></fieldset> <br> </body> </html> My question is how to send it with php? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/138028-sending-a-form/ Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 You would need to change the action for the <form> to some_page.php. Then on that page you would do what you need to with the data using $_POST. I suggest you read up on a few tutorials about posting data using forms. Quote Link to comment https://forums.phpfreaks.com/topic/138028-sending-a-form/#findComment-721391 Share on other sites More sharing options...
redskin Posted December 22, 2008 Author Share Posted December 22, 2008 Thank for explaination. So i have to add a page.php <form method="get" action="ordercheck.php" name="data"> In the javascript want to get from input fields and select option. is it possible that use a name field and on the next page using $_post[""] to get it? or is it possible to get it from the table id? Quote Link to comment https://forums.phpfreaks.com/topic/138028-sending-a-form/#findComment-721403 Share on other sites More sharing options...
ngreenwood6 Posted December 22, 2008 Share Posted December 22, 2008 That would probably be a question for the javascript forum. I do not know a whole lot about javascript still a noob compared to some of the other folks on this site. Quote Link to comment https://forums.phpfreaks.com/topic/138028-sending-a-form/#findComment-721601 Share on other sites More sharing options...
Maq Posted December 22, 2008 Share Posted December 22, 2008 These questions you're asking are very broad. You should do research on forms first. Please come back with specific questions. There are plenty of tutorials, examples, topics etc... already out there that you can reference. Quote Link to comment https://forums.phpfreaks.com/topic/138028-sending-a-form/#findComment-721692 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.