multiple columns in body - html

Hi I have a form which I want to make 5 forms below in 5 columns in the body. I know that it is possible. Can you please help me ?
----------------------------------------------------
| | | |
| Column 1 | Column 2 | Column 3 |
| | | |
----------------------------------------------------
<table cellspacing="10">
<tr>
<td><font color="black">*</font>Ref. No: </td>
<td><input type="text" onkeypress="return numeric(event); "value="<?PHP if(isset($_POST['code'])) echo htmlspecialchars($_POST['code']);?>" name="code" ></td>
</tr>
<tr>
<td><font color="black">*</font>Serial No: </td>
<td><input type="text" value="<?PHP if(isset($_POST['serialnumber'])) echo htmlspecialchars($_POST['serialnumber']);?>" name="serialnumber"><br></td>
</tr>
<tr>
<td><font color="black">*</font>Item Model: </td>
<td><input type="text" value="<?PHP if(isset($_POST['model'])) echo htmlspecialchars($_POST['model']);?>" name="model"></td>
</tr>
<tr>
<td><font color="black">*</font>Description </td>
<td> <input type="text" value="<?PHP if(isset($_POST['description'])) echo htmlspecialchars($_POST['description']);?>" name="description"><br></td>
</tr>
</table>

A solution to your problem, while using tables, is to put all the labels in the first row, and all the inputs in the second.
http://codepen.io/anon/pen/pyXgyW
<table cellspacing="10">
<tr>
<td><font color="black">*</font>Ref. No: </td>
<td><font color="black">*</font>Serial No: </td>
<td><font color="black">*</font>Item Model: </td>
<td><font color="black">*</font>Description </td>
</tr>
<tr>
<td><input type="text" onkeypress="return numeric(event); "value="<?PHP if(isset($_POST['code'])) echo htmlspecialchars($_POST['code']);?>" name="code" ></td>
<td><input type="text" value="<?PHP if(isset($_POST['serialnumber'])) echo htmlspecialchars($_POST['serialnumber']);?>" name="serialnumber"><br></td>
<td><input type="text" value="<?PHP if(isset($_POST['model'])) echo htmlspecialchars($_POST['model']);?>" name="model"></td>
<td> <input type="text" value="<?PHP if(isset($_POST['description'])) echo htmlspecialchars($_POST['description']);?>" name="description"><br></td>
</tr>
</table>
Expanding on this, you could nest your form table inside another four or five column table, like this: http://codepen.io/anon/pen/pyXgyW

Regarding the table:
Each row in a table is tagged by <tr>.
In this (row) you may insert any data as <td> (table data)
Column headers are tagged by <th> (table head(er))
Regarding the form:
To reach your goal you have to choose from 2 ways:
You use javascript to create a formData element and just add the data of the inputs. See: https://developer.mozilla.org/en-US/docs/Web/API/FormData/append
You create the form and add a table into it holding different inputs in the cells. Don't forget to name them so you can reach the data to serverside.
I would choose the first way.

Related

Current input value does not get passed to event handler in AngularJS

<tr ng-repeat="item in groups">
<td hidden><input type="hidden" value="{{item.id_group}}" /></td>
<td><input type="text" value="{{item.description}}" class="form-control" /></td>
<td>
Edit |
Delete
</td>
</tr>
So this code was supposed to show values in a table and when the user changes anything in the description and click on Edit, it should POST the new value to the server. Instead it's posting the old value, I need some help please to identify why this is happening.
Try using Ng-model
<tr ng-repeat="item in groups track by $index">
<td hidden><input type="hidden" ng-model="groups[$index].id_group" /></td>
<td><input type="text" ng-model="groups[$index].description" class="form-control" /></td>
<td>
Edit |
Delete
</td>
</tr>

HTML - Issue with form submission

Issue with submitting form, I don't see anything wrong with the form section.
This is an example of my code, The ticket number and user ID is being pushed into from MYSQL. When it gets to the server side after submitting, I am getting only 2 of 21 items. The readonly is only on the top 2 items, the rest is entered by end user.
<form action="<?php echo $NAV_includes_Research_Upload; ?>" method="POST">
<table class="Table_Center">
<tr>
<td>Ticket number:</td>
<td><input type="text" id="ticket" class="all" value="<?php echo "1"; ?>" readonly></td>
</tr>
<tr>
<td>User ID:</td>
<td><input type="text" id="user" class="all" value="<?php echo "test"; ?>" readonly>
</tr>
<tr>
<td>Site:</td>
<td><input type="url" id="website" class="all" autofocus required <?php if ($testing === 'ON') {echo 'value="http://www.google.com"';}?>></td>
</tr>
</table>
<table class="Table_Center">
<tr>
<td><input type="reset" value="Reset"></td>
<td><input type="submit" class="f_right" value="Submit"></td>
</tr>
</table>
</form>
Thank you, it was the name section that was missing.
I will have to remember that.
In your form code, I am unable to find name attribute of input fields. In an HTML form Post, values entered by the user and submitted are called by the name attribute.

How to pass get parameter via submit button

Hello i have a form which i am receiving parameter from previous page, so i want to pass the both value of the form plus parameter which i have received from from previous page.
Here is my code
<?php
$remoteemployeeid = $_GET['RemoteEmployeeID']; // parameter to be pass to next page via submit button
?>
<form action="Remote Employee Transaction History_exe.php" name="TransactionForm" method="post">
<table width="1280px" border="0" cellpadding="3" style="font-family:Verdana; margin-top:30px; margin-left:28px;" align="center">
<tr>
<td height="99" colspan="2" align="left" valign="middle">
<p><font size="+3"> Remote Employee Transaction History Page</font></p>
</td>
</tr>
<tr>
<td width="32%">Remote Employee Earn Amount:</td>
<td width="68%"><input type="number" id="earnamount" name="earnamount" onChange="transaction()" ></td>
</tr>
<tr>
<td>Remote Employee Tax Deduction:</td>
<td><select name="taxdeduction" id="taxdeduction" onChange="transaction()"><br />
<option selected="selected">Tax Deduction</option>
<option value="2">Two Percent</option>
<option value="7">Seven Percent</option>
<option value="10">Ten Percent</option>
</select></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">Remote Employee Amount Payable:</td>
<td bgcolor="#CCCCCC"><input type="number" id="amountpayable" name="amountpayable" readonly></td>
</tr>
<tr>
<td>Remote Employee Amount Paid:</td>
<td><input type="number" id="amountpaid" name="amountpaid" onChange="transaction()" ></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">Remote Employee Amount Remain With Office:</td>
<td bgcolor="#CCCCCC"><input type="number" id="amountremainwithoffice" name="amountremainwithoffice" readonly ></td>
</tr>
<tr>
<td><input type="submit" value="Submit To Database"></td>
</tr>
</table>
</form>
action="Remote Employee Transaction History_exe.php"
change to action="Remote Employee Transaction History_exe.php?RemoteEmployeeID=<?php echo $_GET['RemoteEmployeeID']; ?>"
But beware this is very easy to mess with, as you can change the RemoteEmployeeID by just changing the url in the browser addressfield.
A better approach would be to use php sessions.

How to read multiple textboxes and insert into database?

How can I update multiple textbox in database using ASP.NET Web Pages(razor syntax). I want to edit emails of students. And the number of rows containing textbox varies or dynamic. Somebody help.
<tr>
<th>Name</th>
<th>Email</th>
</tr>
<tr>
<td>Jason</td>
<td><input type="text" name="txtbox1"></td>
</tr>
<tr>
<td>Kripkee</td>
<td><input type="text" name="txtbox2"></td>
</tr>
<tr>
<td>Kane</td>
<td><input type="text" name="txtbox3"></td>
</tr>
<tr>
<td>Michael</td>
<td><input type="text" name="txtbox4"></td>
</tr>
<tr>
<td><input type="submit" value="Update"></td>
</tr>
</table>
</form>
You can try this:
Assuming you have a view model providing a list of students.
View -
#foreach (var student in Model.Students)
{
<tr>
<td>#student.Name</td>
<td><input name="studentEmails[#student.Id]"/></td>
</tr>
}
Controller -
public ActionResult UpdateEmails(IDictionary<int, string> studentEmails)

Geting the first line in the textarea from database

I am trying to retrieve the value of an HTML textarea in jsp page from mysql database.The problem I am having is that I only can get he first line in the textarea(When I'm saving address in databse, It's retrieving first line only). This is happening for text box also, where data has space in the database, it's only getting first line of the data.
Thanks in advance.
HTML Code:
<div class="container2">
<table>
<tr>
<td align="right">TPO Name</td>
<td><input type="text" readonly name="tponame" value=<%=rs.getString("tponame")%>></td>
</tr>
<tr>
<td align="right">Name of College</td>
<td><input type="text" readonly name="college_name" value=<%=rs.getString("college_name")%>></td>
</tr>
<tr>
<td align="right">Contact Number</td>
<td><input type="text" name="contactno" value=<%=rs.getString("contactno")%>></td>
</tr>
<tr>
<td align="right">Contact Email</td>
<td><input type="text" name="contactemail" value=<%=rs.getString("contactemail")%>></td>
</tr>
<tr>
<td align="right">Address</td>
<td><input type="text" name="address" value=<%=rs.getString("address")%>></td>
</tr>
<tr>
<td colspan="2"><input type="submit" class="button" value="Update" style="float:right;"></input></td>
</tr>
JSP code:
<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/FMS","root","root");
Statement st=con.createStatement();
String tponame= request.getParameter("tponame");
String college_name=request.getParameter("college_name");
String contactno=request.getParameter("contactno");
String contactemail=request.getParameter("contactemail");
String address=request.getParameter("address");
String sql = ("update tpo_details set contactno='"+contactno+"',contactemail='"+contactemail+"',address='"+address+"' where tponame='"+tponame+"'");
st.executeUpdate(sql);
response.sendRedirect("update_tpo_network_data.jsp");
%>