Why i am getting Undefined index? - html

i am developing an application using CodeIgniter. In my application when i submit the form in firefox 10.0, i got this error
Message: Undefined index: adcopy_response
But when i submits the form in IE 9. It's working fine my application. No errors found in IE. Can any one. My HTML code is
<table>
<form action="" method="post">
<tr id="row">
<td><b>Title:</b></td>
<td>
<input type="text" style="width:450px;" name="title" value="" />
</td>
</tr>
<tr id="row">
<td><b>Description:</b></td>
<td>
<textarea style="width:450px;" name="desc" cols="35" rows="10"></textarea>
</td>
</tr>
<tr id="row">
<td><b>URL:</b></td>
<td>
<input type="text" style="width:450px;" name="url" value="" />
</td>
</tr>
<tr id="row">
<td><b>Category:</b></td>
<td>
<select name="cat">
<option value="">Select Category</option>
<option value="ajax-tutorials">AJAX Tutorials</option><option value="asp-tutorials">ASP Tutorials</option><option value="asp.net-tutorials">ASP.NET Tutorials</option><option value="codeigniter-tutorials">CodeIgniter Tutorials</option><option value="css-tutorials">CSS Tutorials</option><option value="html-tutorials">HTML Tutorials</option><option value="javascript-tutorials">JavaScript Tutorials</option><option value="jquery-tutorials">jQuery Tutorials</option><option value="ms-sql-tutorials">Ms SQL Tutorials</option><option value="mysql-tutorials">MySQL Tutorials</option><option value="php-tutorials">PHP Tutorials</option><option value="programming-tutorials">Programming Tutorials</option><option value="wordpress-themes">Wordpress Themes</option><option value="wordpress-tutorials">WordPress Tutorials</option><option value="xml-tutorials">XML Tutorials</option> </select>
</td>
</tr>
<tr id="row">
<td><b>Prove you're not a robot</b></td>
<td>
<script type="text/javascript" src="http://api.solvemedia.com/papi/challenge.script?k=hse4RWPEOMayq3QzRQiUZTnTtVkI8Jmf"></script>
<noscript>
<iframe src="http://api.solvemedia.com/papi/challenge.noscript?k=XXXX" height="300" width="500" frameborder="0"></iframe><br/>
<textarea name="adcopy_challenge" rows="3" cols="40"></textarea>
<input type="hidden" name="adcopy_response" value="manual_challenge"/>
</noscript> </td>
</tr>
<tr id="row">
<td>
<input type="hidden" name="ok" value="1" />
<input type="hidden" name="by" value="seekphp" />
<input type="submit" name="submit" value="Submit Tutorial" />
</td>
</tr>
</form>
</table>
and CI code is
function submit(){
$privkey="XXXX";
$hashkey="XXXX";
$data['err'] = "";
$this->form_validation->set_rules('title', 'Title', 'required|trim|xss_clean|htmlentities');
$this->form_validation->set_rules('desc', 'Description', 'required|trim|xss_clean|htmlentities');
$this->form_validation->set_rules('url', 'URL', 'required|trim|xss_clean');
$this->form_validation->set_rules('cat', 'Category', 'required|trim|xss_clean');
if($this->form_validation->run() == FALSE){
} else {
$title = $this->input->post('title');
$desc = $this->input->post('desc');
$url = $this->input->post('url');
$cat = $this->input->post('cat');
$by = $this->input->post('by');
$ok = $this->input->post('ok');
$solvemedia_response = $this->Captcha_model->solvemedia_check_answer($privkey,
$_SERVER["REMOTE_ADDR"],
$_POST["adcopy_challenge"],
$_POST["adcopy_response"],
$hashkey);
if ($solvemedia_response->is_valid) {
if($this->Tutorial_model->add_tut($title, $desc, $url, $cat, $by, $ok) == TRUE){
$this->session->set_flashdata('msg', "Tutorial has been added successfully.");
redirect(base_url().'user/submit', 'refresh');
} else {
$this->session->set_flashdata('err', "Tutorial may already exist or there is an error while submitting tutorial.");
redirect(base_url().'user/submit', 'refresh');
}
} else {
$data['err'] = "Incorrect Captcha.";
}
}
$data['cats'] = $this->Category_model->get_all_cats();
$this->load->view("user/submit_view", $data);
}
and when i print_r($_POST);
i got the following
Array ( [title] => test title [desc] => test desc [url] => test url [cat] => javascript-tutorials [adcopy_challenge] => 2#hse4RWPEOMayq3QzRQiUZTnTtVkI8Jmf#Szx1Cc29gNUENU8bgrSwY39APTC4lJjoCYJjyXvIJi2gPnq5tZIMpr0JgoGocL4bVHKrYt6Zyx3w-DAv2nYsjYiaeT-0C9Ec297zPussZKqXHDAdWTWT7ZcC1MklNV75-TPQzGDGu0yUgkDQWcRup.sNAOGBvK0cXCac1RzQ7T6adyI4bmcrNTpt7ANEEq2-1QcBgS8Uky6FxFHeFyGMDgzlJvqGyrBJfDRBNwroHBUXGHC1Jza9b54IS1.0E9kwlqZUOeBX9EomSEVcgrS6gA [ok] => 1 [by] => seekphp [submit] => Submit Tutorial ) 1

Even if you think you know what should be in the $_POST array, don't assume it if you want to avoid notices. Codeigniter has the Input class to make this easier:
$_POST['doesnt exist']; // generates undefined index notice
$this->input->post('doesnt exist'); // returns FALSE, no notice
Most importantly, you have the input in a <noscript> tag, so the browser may not send the value.
But when I submit the form in IE9 it's working fine, no errors found.
Chances are you either have javascript turned off, or IE is misbehaving (quite likely).

I think $_POST["adcopy_response"] is being used on Captcha Model but it is not in $_POST

Finally i resolved the problem by removing <table> <tr> <td> tags

Place your hidden tag out of <noscript> tag. only When script is disabled in your browser, code inside the <noscript> will work. Disable script in your browser and then run it will perfectly work.

Related

How to disable/ hide all buttons after one click on any button (cshtml)

i would like to know how to disable/hide all the buttons once user clicks on any of the buttons. I am only allowed to use c# or html. I have found solutions in Javascript but i cannot use it. (i did not upload my razor c# code due to lack of space)
I am creating a program that allows user to vote for any one of the candidates. Once user has clicked and chosen on one candidate, the voting result will be displayed and user should not be allowed to vote again.
<!DOCTYPE html>
<html>
<head>
<title>Elections</title>
</head>
<body>
<form id="form1" method="post">
<div>
<table>
<tr>
<td>Harry</td>
<td><input id="Harry" name="submit" type="submit" value="Vote Harry" /></td>
</tr>
<tr>
<td>John</td>
<td><input id="John" name="submit" type="submit" value="Vote John" /></td>
</tr>
<tr>
<td>Bryan</td>
<td><input id="Bryan" name="submit" type="submit" value="Vote Bryan" /></td>
</tr>
<tr>
<td>Jack</td>
<td><input id="Jack" name="submit" type="submit" value="Vote Jack" /></td>
</tr>
</table>
</div>
<div>
#if (result != "")
{
<p>#result</p>
}
<!--Ensure that user has voted before showing the vote results-->
#if (voteCheck == true)
{
<p>Total Votes: #Session["totalVotes"]</p> <!--using session allows values to be kept even after button click-->
<p> Harry: #Session["Harry"]</p>
<p> John: #Session["John"]</p>
<p> Bryan: #Session["Bryan"]</p>
<p> Jack: #Session["Jack"]</p>
}
</div>
</form>
</body>
</html>
You need an action attribute to the form action="youraction/controller here"
And in youraction you write some C# code return list of display value ("none" or "")
And in cshtml you add style="display:#display"
<input id="Harry" name="submit" type="submit" style="display:#display" value="Vote Harry" />
You could simply add a Ternary operator that check the session object and sets the disabled property accordingly.
<input id="Harry" #(Session["Harry"] != null ? "disabled" : "") name="submit" type="submit" value="Vote Harry" />

(Homework) How to change HTML background (with Perl CGI) using input and cookies from user?

Everything works except the background color of the HTML page in the very last CGI. Can somebody help me please? I am very stuck. I don't know why the background color won't change.
Here is the HTML:
<table border="2" cellspacing="5" cellpadding="5">
<tr>
<td align="center">Name</td>
<td><input type="text" name="customer" size="15"></td>
</tr>
<tr>
<td align="center">Select Membership Type</td>
<td>
<input type="radio" name="membership" value="0">Life
<input type="radio" name="membership" value="1">Annual
<input type="radio" name="membership" value="2">Free Trial
</td>
</tr>
<tr>
<td align="center">Choose Background Color</td>
<td>
<select name="color">
<option value="ye">Yellow
<option value="cy">Cyan
<option value="ma">Magenta
<option value="wh">White
<option value="pi">Pink
<option value="go">Gold
<option value="pa">PapayaWhip
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Sign Up and Set Options"></td>
</tr>
</table>
</form>
CGI that saves user's cookie from HTML above:
I am to use an array to hold the membership types, and a hash that
uses the option tag attribute values as keys for the full color names
my $customer = param('customer');
my $chosen_membership = param('membership');
my $color = param('color');
my #membership_type = ("Life", "Annual", "Free Trial");
my %colors = ("ye" => 'Yellow',
"cy" => 'Cyan',
"ma" => 'Magenta',
"wh" => 'White',
"pi" => 'Pink',
"go" => 'Gold',
"pa" => 'Papayawhip');
my $chosen_color = $colors{$color};
my $mycookie1 = cookie(-name=>'membership',
-value=>$membership_type[$chosen_membership],
-path=>'/',
-expires=>'+7d');
my $mycookie2 = cookie(-name=>'customer',
-value=>$customer,
-path=>'/',
-expires=>'+7d');
my $mycookie3 = cookie(-name=>"color",
-value=>$chosen_color,
-path=>'/',
-expires=>'+7d');
print header(-cookie => [$mycookie1, $mycookie2, $mycookie3]);
print start_html ( -title => 'Assignment 7');
print "Thank you. Your data has been recorded</br>";
print "<a href='test3.cgi'>See member page</a>";
print end_html;
Reading the cookie and using the selected color from the HTML as the background color for the page
my $membership_name = cookie("membership");
my $customer_name = cookie("customer");
my $color_name = cookie("color");
print header, start_html;
#what the hell, how to change background color??
<body bgcolor="$color_name">;
print "<h2>Welcome back, $membership_name Member $customer_name.</h2>";
print "<h4>Site rather poor, huh? Sorry. We are working on it.</h4>";
print end_html;
<body bgcolor="$color_name">;
You're missing a print and some quotes here. I'm surprised this runs at all.
What you probably mean is:
print "<body bgcolor='$color_name'>";

Why can't I submit my form with WWW::Mechanize::Firefox in Perl?

I have an HTML this is part of the form I'm working on
<form action="/goform/FormUpdateVAP" autocomplete="off" name="myform" id="formid" method="POST">
<table>
<tbody>
<tr>
<td align="right"><span class="label">Name:</span></td>
<td><input id="essid" name="essid" value="X" type="text"></td>
</tr>
<tr>
<td align="right"><input id="broadcast_essid" name="broadcast_essid" value="any" checked="" type="checkbox"></td>
<td><span class="label">Broadcast name:</span></td>
</tr>
</tbody>
</table>
<!-- BEGIN RIGHT COLUMN -->
<table>
<tbody><tr>
<td>
<input name="authentication" id="authentication" value="any" onclick="Update();" type="checkbox"><span class="label"><b>authentication</b></span>
</td>
<td>
<input onclick="Update();" name="wp" id="wp" value="any" type="checkbox"><span class="label"><b>Wp</b></span>
<select id="8021x_mode" name="8021x_mode" onchange="Update();"><option value="wpa">WPA</option>
<option value="wep">WEP</option>
</select>
</td>
</tr>
<tr>
<td height="26">
<input onclick="Update();" name="w_p" id="w_p" value="any" type="checkbox"><span class="label"><b>Wp</b></span>
<select id="8021x_mode" name="8021x_mode" onchange="Update();"><option value="wpa">WPA</option>
<option value="wep">WEP</option>
</select>
</td>
</tr>
<tr>
<td>
<input id="cancel" name="cancel" value="Cancel" onclick="window.location.href = '/fg/list.asp';" type="button">
</td>
<td>
<input id="add-2" name="add" value="Save" type="submit">
</td>
</tr>
</tbody>
</table>
I'm trying to submit it filling the Name and the Broadcast name. And checking the 8021x_mode and the wp checkboxes. If I tick 8021x_mode and set the fields the form submits just fine. But when I try ticking wp it doesn't submit. I got no error messages.
Here's my code so far:
use WWW::Mechanize::Firefox;
use Crypt::SSLeay;
use URI::Fetch;
use HTML::TagParser;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; #not verifying certificate
my $url = 'https://';
$url = $url.#ARGV[0];
my $mech = WWW::Mechanize::Firefox->new;
$mech->get($url);
$mech->form_id('formid');
$mech->tick( '8021x_mode','any');
$mech->tick( 'wp','any'); --after I add this the form doesn't submit
my $name = #ARGV[1];
$mech->set_fields(
'vap_name' => $name,
'essid' => $name,
);
$mech->click_button( id => 'add-2' );
$mech->reload();
add-2 is the submit button. Any idea why is not working? If you need more information please let me now. Any help will be highly appreciated.
The problem is that the html doesn't contains the choice any for 8021x_mode.
I get this error :
No elements found for Checkbox with name '8021x_mode' and value 'any'
at test.pl line 24.
To check the form, I recommend you the mech-dump utility (installed with WWW::Mechanize)
$ mech-dump --forms http://domain.tld/path_to_forms
POST /goform/FormUpdateVAP [myform]
essid=X (text)
broadcast_essid=<UNDEF> (checkbox) [*<UNDEF>/off|any]
authentication=<UNDEF> (checkbox) [*<UNDEF>/off|any/authentication]
wp=<UNDEF> (checkbox) [*<UNDEF>/off|any/Wp]
8021x_mode=wpa (option) [*wpa/WPA|wep/WEP]
w_p=<UNDEF> (checkbox) [*<UNDEF>/off|any/Wp]
8021x_mode=wpa (option) [*wpa/WPA|wep/WEP]
cancel=Cancel (button)
add=Save (submit)
As you can see, there's no any choice...
Maybe the javascript there is doing some things that we don't know.
A workaround is to use LiveHttpHeaders Firefox addon to catch the forms POSTed to /goform/FormUpdateVAP and then instead of ticking, do a POST request with WWW::Mechanize.

Passing variables from PHP to Perl using POST

This one is a tad frustrating.
If I run this perl script ...
#!/usr/bin/perl
use CGI qw/:standard/; # load standard CGI routines
my $query = new CGI;
my $club5 = $query->param('club5');
my $messagetext = $query->param('messagetext');
print header, # create HTTP header
start_html('Hello World'), # start of HTML
h1('Hello World'), # level 1 headers
h1($club5),
h1($messagetext),
end_html; # end of HTML
1;
from a remote Chrome browser with
http://www.<hostname>/cgi-bin/message_test.pl?club5=coop9&messagetext=test
the correct page is produced. But if I then execute this PHP program ...
<?php
$user_id = "10006";
echo <<<END
<html>
<head>
<title>Send Message</title>
</head>
<BODY bgcolor="#e8e8e8">
<br>
<table width="450px" height="150px" align="center" valign="top" bgcolor="#e8e8e8">
<form action="http://<hostname>/cgi-bin/message_test.pl" method="post">
<INPUT TYPE="hidden" NAME="user_id" VALUE="$user_id">
<tr align="center" valign="top">
<td>
<br>
<font face="Verdana" size="2">
<input name="messagetext" type="text" size="64">
<br>
<br>
<br><center>
<input name="submit" type="submit" value="SEND">
</font>
</td>
</tr>
</form>
</table>
</body>
</html>
END;
?>
from the same browser with
http://<hostname>/message_test.php
nothing is returned. I swear I had something similar this running a year ago. Is there something new I should be aware of when passing (hidden) variables to Perl using HTTP POST?
It's failing because your browser incorrectly guesses what you meant by your invalid HTML.
It worked after I changed
<table ...>
<form ...>
<INPUT TYPE="hidden" NAME="user_id" VALUE="$user_id">
...
</form>
</table>
to
<form ...>
<INPUT TYPE="hidden" NAME="user_id" VALUE="$user_id">
<table ...>
...
</table>
</form>
In PHP, shouldn't
<INPUT TYPE="hidden" NAME="user_id" VALUE="$user_id">
be
<INPUT TYPE="hidden" NAME="user_id" VALUE="<? echo $user_id; >">
?

HTML: Is it possible to have a FORM tag in each TABLE ROW in a XHTML valid way?

I can best describe this as follows:
I want this (entire table in editmode and save button in every row).
<table>
<tr>
<td>Id</td>
<td>Name</td>
<td>Description</td>
<td> </td>
</tr>
<tr>
<td><input type="hidden" name="id" value="1" /></td>
<td><input type="text" name="name" value="Name" /></td>
<td><input type="text" name="description" value="Description" /></td>
<td><input type="submit" value="Save" /></td>
</tr>
<tr>
<td><input type="hidden" name="id" value="2" /></td>
<td><input type="text" name="name" value="Name2" /></td>
<td><input type="text" name="description" value="Description2" /></td>
<td><input type="submit" value="Save" /></td>
</tr>
<!-- and more rows here ... -->
</table>
Where should I put the <form> tags?
It's worth mentioning that this is possible in HTML5, using the "form" attribute for input elements:
<table>
<tr>
<td>Id</td>
<td>Name</td>
<td>Description</td>
<td> </td>
</tr>
<tr>
<td><form id="form1"><input type="hidden" name="id" value="1" /></form></td>
<td><input form="form1" type="text" name="name" value="Name" /></td>
<td><input form="form1" type="text" name="description" value="Description" /></td>
<td><input form="form1" type="submit" value="Save" /></td>
</tr>
<tr>
<td><form id="form2"><input type="hidden" name="id" value="1" /></form></td>
<td><input form="form2" type="text" name="name" value="Name" /></td>
<td><input form="form2" type="text" name="description" value="Description" /></td>
<td><input form="form2" type="submit" value="Save" /></td>
</tr>
</table>
While clean in its lack of JS and use of original elements, unfortunately this isn't working in IE10.
I had a similar question and this answer in question HTML: table of forms? solved it for me. (Not sure if it is XHTML, but it works in an HTML5 browser.)
You can use css to give table layout to other elements.
.table { display: table; }
.table>* { display: table-row; }
.table>*>* { display: table-cell; }
Then you use the following valid html.
<div class="table">
<form>
<div>snake<input type="hidden" name="cartitem" value="55"></div>
<div><input name="count" value="4" /></div>
</form>
</div>
You can't. Your only option is to divide this into multiple tables and put the form tag outside of it. You could end up nesting your tables, but this is not recommended:
<table>
<tr><td><form>
<table><tr><td>id</td><td>name</td>...</tr></table>
</form></td></tr>
</table>
I would remove the tables entirely and replace it with styled html elements like divs and spans.
I wrote the below over ten years ago, when the world was a different place. These days I know of many ways to crack this particular nut, but a quick and dirty solution that will validate is to do much the same but use CSS tables for layout, not a regular HTML table.
I'd say you can, although it doesn't validate and Firefox will re-arrange the code (so what you see in 'View generated source' when using Web Developer may well surprise). I'm no expert, but putting
<form action="someexecpage.php" method="post">
just ahead of the
<tr>
and then using
</tr></form>
at the end of the row certainly gives the functionality (tested in Firefox, Chrome and IE7-9). Working for me, even if the number of validation errors it produced was a new personal best/worst! No problems seen as a consequence, and I have a fairly heavily styled table. I guess you may have a dynamically produced table, as I do, which is why parsing the table rows is a bit non-obvious for us mortals. So basically, open the form at the beginning of the row and close it just after the end of the row.
The answer of #wmantly is basicly 'the same' as I would go for at this moment.
Don't use <form> tags at all and prevent 'inappropiate' tag nesting.
Use javascript (in this case jQuery) to do the posting of the data, mostly you will do it with javascript, because only one row had to be updated and feedback must be given without refreshing the whole page (if refreshing the whole page, it's no use to go through all these trobules to only post a single row).
I attach a click handler to a 'update' anchor at each row, that will trigger the collection and 'submit' of the fields on the same row. With an optional data-action attribute on the anchor tag the target url of the POST can be specified.
Example html
<table>
<tbody>
<tr>
<td><input type="hidden" name="id" value="row1"/><input name="textfield" type="text" value="input1" /></td>
<td><select name="selectfield">
<option selected value="select1-option1">select1-option1</option>
<option value="select1-option2">select1-option2</option>
<option value="select1-option3">select1-option3</option>
</select></td>
<td><a class="submit" href="#" data-action="/exampleurl">Update</a></td>
</tr>
<tr>
<td><input type="hidden" name="id" value="row2"/><input name="textfield" type="text" value="input2" /></td>
<td><select name="selectfield">
<option selected value="select2-option1">select2-option1</option>
<option value="select2-option2">select2-option2</option>
<option value="select2-option3">select2-option3</option>
</select></td>
<td><a class="submit" href="#" data-action="/different-url">Update</a></td>
</tr>
<tr>
<td><input type="hidden" name="id" value="row3"/><input name="textfield" type="text" value="input3" /></td>
<td><select name="selectfield">
<option selected value="select3-option1">select3-option1</option>
<option value="select3-option2">select3-option2</option>
<option value="select3-option3">select3-option3</option>
</select></td>
<td><a class="submit" href="#">Update</a></td>
</tr>
</tbody>
</table>
Example script
$(document).ready(function(){
$(".submit").on("click", function(event){
event.preventDefault();
var url = ($(this).data("action") === "undefined" ? "/" : $(this).data("action"));
var row = $(this).parents("tr").first();
var data = row.find("input, select, radio").serialize();
$.post(url, data, function(result){ console.log(result); });
});
});
A JSFIddle
You just have to put the <form ... > tag before the <table> tag and the </form> at the end.
Hopte it helps.
In fact I have the problem with a form on each row of a table, with javascript (actually jquery) :
like Lothre1 said, "some browsers in the process of rendering will close form tag right after the declaration leaving inputs outside of the element"
which makes my input fields OUTSIDE the form, therefore I can't access the children of my form through the DOM with JAVASCRIPT..
typically, the following JQUERY code won't work :
$('#id_form :input').each(function(){/*action*/});
// this is supposed to select all inputS
// within the form that has an id ='id_form'
BUT the above exemple doesn't work with the rendered HTML :
<table>
<form id="id_form"></form>
<tr id="tr_id">
<td><input type="text"/></td>
<td><input type="submit"/></td>
</tr>
</table>
I'm still looking for a clean solution (though using the TR 'id' parameter to walk the DOM would fix this specific problem)
dirty solution would be (for jquery):
$('#tr_id :input').each(function(){/*action*/});
// this will select all the inputS
// fields within the TR with the id='tr_id'
the above exemple will work, but it's not really "clean", because it refers to the TR instead of the FORM, AND it requires AJAX ...
EDIT : complete process with jquery/ajax would be :
//init data string
// the dummy init value (1=1)is just here
// to avoid dealing with trailing &
// and should not be implemented
// (though it works)
var data_str = '1=1';
// for each input in the TR
$('#tr_id :input').each(function(){
//retrieve field name and value from the DOM
var field = $(this).attr('name');
var value = $(this).val();
//iterate the string to pass the datas
// so in the end it will render s/g like
// "1=1&field1_name=value1&field2_name=value2"...
data_str += '&' + field + '=' + value;
});
//Sendind fields datawith ajax
// to be treated
$.ajax({
type:"POST",
url: "target_for_the_form_treatment",
data:data_string,
success:function(msg){
/*actions on success of the request*/
});
});
this way, the "target_for_the_form_treatment" should receive POST data as if a form was sent to him (appart from the post[1] = 1, but to implement this solution i would recommand dealing with the trailing '&' of the data_str instead).
still I don't like this solution, but I'm forced to use TABLE structure because of the dataTables jquery plugin...
Im late to the party, but this worked great for me and the code should explain itself;
<script type="text/javascript">
function formAJAX(btn){
var $form = $(btn).closest('[action]');
var str = $form.find('[name]').serialize();
$.post($form.attr('action'), str, function(data){
//do stuff
});
}
<script>
HTML:
<tr action="scriptURL.php">
<td>
Field 1:<input type="text" name="field1"/>
</td>
<td>
Field 2:<input type="text" name="field2" />
</td>
<td><button type="button" onclick="formAJAX(this)">Update</button></td>
</tr>
If you try to add a form warping a tr element like this
<table>
<form>
<tr>
<td><input type="text"/></td>
<td><input type="submit"/></td>
</tr>
</form>
</table>
some browsers in the process of rendering will close form tag right after the declaration leaving inputs outside of the element
something like this
<table>
<form></form>
<tr>
<td><input type="text"/></td>
<td><input type="submit"/></td>
</tr>
</table>
This issue is still valid for warping multiple table cells
As stereoscott said above, nesting tables are a possible solution which is not recommended.
Avoid using tables.
<table >
<thead >
<tr>
<th>No</th><th>ID</th><th>Name</th><th>Ip</th><th>Save</th>
</tr>
</thead>
<tbody id="table_data">
<tr>
<td>
<form method="POST" autocomplete="off" id="myForm_207" action="save.php">
<input type="hidden" name="pvm" value="207">
<input type="hidden" name="customer_records_id" value="2">
<input type="hidden" name="name_207" id="name_207" value="BURÇİN MERYEM ONUK">
<input type="hidden" name="ip_207" id="ip_207" value="89.19.24.118">
</form>
1
</td>
<td>
207
</td>
<td>
<input type="text" id="nameg_207" value="BURÇİN MERYEM ONUK">
</td>
<td>
<input type="text" id="ipg_207" value="89.19.24.118">
</td>
<td>
<button type="button" name="Kaydet_207" class="searchButton" onclick="postData('myForm_207','207')">SAVE</button>
</td>
</tr>
<tr>
<td>
<form method="POST" autocomplete="off" id="myForm_209" action="save.php">
<input type="hidden" name="pvm" value="209">
<input type="hidden" name="customer_records_id" value="2">
<input type="hidden" name="name_209" id="name_209" value="BALA BAŞAK KAN">
<input type="hidden" name="ip_209" id="ip_209" value="217.17.159.22">
</form>
2
</td>
<td>
209
</td>
<td>
<input type="text" id="nameg_209" value="BALA BAŞAK KAN">
</td>
<td>
<input type="text" id="ipg_209" value="217.17.159.22">
</td>
<td>
<button type="button" name="Kaydet_209" class="searchButton" onclick="postData('myForm_209','209')">SAVE</button>
</td>
</tr>
</tbody>
</table>
<script>
function postData(formId,keyy){
//alert(document.getElementById(formId).length);
//alert(document.getElementById('name_'+keyy).value);
document.getElementById('name_'+keyy).value=document.getElementById('nameg_'+keyy).value;
document.getElementById('ip_'+keyy).value=document.getElementById('ipg_'+keyy).value;
//alert(document.getElementById('name_'+keyy).value);
document.getElementById(formId).submit();
}
</script>