Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/138028-sending-a-form/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/138028-sending-a-form/#findComment-721403
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.