in the single form there is multiple forward button
suppose image if there are 3 rows den in each row there is forward button and select tag.
hope i clear ur doubt
in the single form there is multiple forward button
suppose image if there are 3 rows den in each row there is forward button and select tag.
hope i clear ur doubt
No, itâs a bit much trying to imagine how your code is laid out. I donât understand why you canât post it, with the names blanked out if that is your worry.
fine⌠den jst show me a code for multiple forward buttons in a table. so dat in can post the values to the next page
hope now u can understand my prblm
Sorry, itâs no clearer than before without seeing the code that you have already. It doesnât seem reasonable (to me) to expect someone else to write code from scratch when you already have some, but with something (hopefully minor) stopping it from working.
Hopefully someone else will be along to help you out. To me, I just wouldnât have multiple buttons, Iâd show the form and put a single âforwardâ button below it.
Youâre expecting people to help you with your code. We need to see the code you have now, rather than the results of that code.
As already mentioned, the forward buttons must have unique names to identify them if within a single form.
If you were to make each row an individual form, it would be a little more complex, because you use a table, wrapping or nesting a form with each row would create invalid html. The workaround would be to create forms with unique IDs outside of the table and use the form
attribute on all inputs to identify the form it belongs to.
my full code
function validateForm() {
var e = document.getElementById("select2");
var strUser = e.options[e.selectedIndex].value;
var f = document.getElementById("select");
var strUser1 = f.options[f.selectedIndex].value;
var option = this.options[this.selectedIndex];
if (strUser == "-2") {
alert("Please select an Action");
return false;
}
else if(strUser1=='0') {
alert("Please select whom you want to forward");
return false;
}
}
</script>
<script>
function check_val(val)
{ alert(val);
}
</script>
</head>
<body>
<FORM name='myForm' method='post' id="myForm" action="so_entry2.php" onsubmit="return validateForm()">
<table border=1px class='table table-hover'>
<thead>
<tr>
<th>S.NO</th>
<th>Recieved Date</th>
<th>Reciept Type</th>
<th>Diary No</th>
<th>Subject</th>
<th>Submitted By</th>
<th>Proposal For</th>
<th>Proposed Action</th>
<th>Submitted/Return To</th>
<th>Click</th>
</tr>
</thead>
<?php $sno=1;
$query=pg_query($connect,"select fl.action_date,fd.reciept_type,fd.diary_no, fd.subject, fd.fwrd_by, fd.fwrd_to,fl.action
from formdetail fd, formlog fl
where fl.fwrd_to=2 and fd.fwrd_to=fl.fwrd_to and fd.diary_no=fl.diary_no
order by action_date desc
");
while ($stmt = pg_fetch_assoc($query))
{
$updated_date=$stmt["action_date"];
$reciept_type=$stmt["reciept_type"];
$diary_no=$stmt["diary_no"];
$subject=$stmt["subject"];
$forward=$stmt["fwrd_by"];
$action=$stmt["action"];
if($forward==1)
{
// $mark_to="Diarist";
$q2=pg_query($connect,"select fl.done_by, u.name, u.emp_code
from formlog fl, users u
where diary_no='$diary_no'and fl.done_by=u.emp_code");
$stmtq = pg_fetch_assoc($q2);
$mark_to=$stmtq["name"];
}
else if($forward==3)
{
$mark_to="Dealing hand";
}
else if($forward==4)
{
$mark_to="DD";
}
else if($forward==5)
{
$mark_to="JD";
}
else if($forward==6)
{
$mark_to="Director";
}
else if($forward==7)
{
$mark_to="VO";
}
else if($forward==8)
{
$mark_to="CVO";
}
$newDate=date("d-m-Y", strtotime($updated_date));
print" <tbody>
<tr>
<td>$sno</td>
<td><font color=blue size=2>$newDate</font></td>
<td>$reciept_type</td>
<td><a href='search_diary2.php?cmd=$diary_no'>$diary_no</td>
<td>$subject</td>
<td><font color='red'>$mark_to:</font></td>
<td><b>$action</b></td>";?>
<td> <select name='select2' class='selectpicker' id='select2'>
<option value='-2'>Return/Forward</option>
<option value='99'>To put up</option>
<option value='88'>Keep in Abeyance</option>
<option value='77'>Discuss</option>
<option value='66'>Others</option> </select> </td>
<td> <select name='select' class='selectpicker' id='select' onchange="check_val(this.value)">
<option value='0'><------select------></option>
<?php $query11=pg_query($connect,"select emp_code, name from users where post='Dealing hand' ");
while ($stmt11 = pg_fetch_assoc($query11))
{ $emp_code=$stmt11["emp_code"];
$emp_name=$stmt11["name"];
print" <option value='".$emp_code."'>".$emp_name." </option>";
} ?>
<option value='4'>DD</option>
<option value='5'>JD</option>
<option value='6'>Director</option>
<option value='7'>VO</option>
<option value='8'>CVO</option>
</select> </td>
<?php print" <input type=hidden name=diary_no value='$diary_no'>
<input type='hidden' value='0' name='hidden1'>
<input type='hidden' value='0' name='hidden2'>";?>
<td><button name=forward>Forward</button></td>
<?php print" </tr>
</tbody>";
$sno++;
}
?>
</table>
</form>
</div>
</body>
</html>
That seems to be the problem then - the loop that draws each row of the table includes a button which has the same name each time.
i tired dis too bt nt wrked
But that will still have the same name for each one. What about adding the $sno
on the end of the name as well?
then wht will be the isset function? for each forward?
And then check the values of each option to see if something has been selected, maybe? Why does it matter which button was pressed, if you want the values of all the selections to be processed when you press one?
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.