PassionCoder
08-14-2012, 10:42 AM
<table>
<tr>
<td>
S.No
</td>
<td>
Column Name
</td>
<td>
Action Buttons
</td>
</tr>
<?php
if($_POST['term'])
{
$data = mysql_query("SELECT * FROM institute where instiname like '%$term%'")
or die(mysql_error());
}
else
{
$data = mysql_query("SELECT * FROM institute")
or die(mysql_error());
}
$var =1;
while($info = mysql_fetch_array( $data ))
{
?>
<tr>
<td>
<?php echo $var;?>
</td>
<td>
<?php echo $info['instiname'] ;?>
</td>
<td>
<img src="images/b_edit.png" title="Edit">
</td>
</tr>
</table>
<?php
}
?>
Here when i click on the edit image,a form should open with
<form>
Column Name:
<input type="text" name="ColumnName" value="<?php echo $info['instiname'] ; ?>" />
</form>
And this form should be in place of our table above....(Replace table with edit form once image(action button) is clicked)And also the id of that particular row should be passed.So that it can be updated to the db again.
I tried to replace using show hide div. as follows:
<div id="columnDetails">
<table>
<tr>
<td>
S.No
</td>
<td>
Column Name
</td>
<td>
Action Buttons
</td>
</tr>
<?php
if($_POST['term'])
{
$data = mysql_query("SELECT * FROM institute where instiname like '%$term%'")
or die(mysql_error());
}
else
{
$data = mysql_query("SELECT * FROM institute")
or die(mysql_error());
}
$var =1;
while($info = mysql_fetch_array( $data ))
{
?>
<tr>
<td>
<?php echo $var;?>
</td>
<td>
<?php echo $info['instiname'] ;?>
</td>
<td>
<!-- <img src="images/b_edit.png" title="Edit">-->
<input type="image" src="images/b_edit.png" onclick=if(document.getElementById('editContent').style.display=='none')
{ document.getElementById('editContent').style.display='';
document.getElementById('columnDetails').style.display='none';
}
else
{
document.getElementById('editContent').style.display='none';
document.getElementById('columnDetails').style.display='';
}
</td>
</tr>
</table>
<?php
}
?>
</div>
The div to be replaced is
<div id="editContent" style="display: none;" >
<form>
Column Name:
<input type="text" name="ColumnName" value="<?php echo $info['instiname'] ; ?>" />
</form>
</div>
Now help me to pass the id of the column name selected/clicked to the edit form.
Thanks & Regards,
Passion Coder.
<tr>
<td>
S.No
</td>
<td>
Column Name
</td>
<td>
Action Buttons
</td>
</tr>
<?php
if($_POST['term'])
{
$data = mysql_query("SELECT * FROM institute where instiname like '%$term%'")
or die(mysql_error());
}
else
{
$data = mysql_query("SELECT * FROM institute")
or die(mysql_error());
}
$var =1;
while($info = mysql_fetch_array( $data ))
{
?>
<tr>
<td>
<?php echo $var;?>
</td>
<td>
<?php echo $info['instiname'] ;?>
</td>
<td>
<img src="images/b_edit.png" title="Edit">
</td>
</tr>
</table>
<?php
}
?>
Here when i click on the edit image,a form should open with
<form>
Column Name:
<input type="text" name="ColumnName" value="<?php echo $info['instiname'] ; ?>" />
</form>
And this form should be in place of our table above....(Replace table with edit form once image(action button) is clicked)And also the id of that particular row should be passed.So that it can be updated to the db again.
I tried to replace using show hide div. as follows:
<div id="columnDetails">
<table>
<tr>
<td>
S.No
</td>
<td>
Column Name
</td>
<td>
Action Buttons
</td>
</tr>
<?php
if($_POST['term'])
{
$data = mysql_query("SELECT * FROM institute where instiname like '%$term%'")
or die(mysql_error());
}
else
{
$data = mysql_query("SELECT * FROM institute")
or die(mysql_error());
}
$var =1;
while($info = mysql_fetch_array( $data ))
{
?>
<tr>
<td>
<?php echo $var;?>
</td>
<td>
<?php echo $info['instiname'] ;?>
</td>
<td>
<!-- <img src="images/b_edit.png" title="Edit">-->
<input type="image" src="images/b_edit.png" onclick=if(document.getElementById('editContent').style.display=='none')
{ document.getElementById('editContent').style.display='';
document.getElementById('columnDetails').style.display='none';
}
else
{
document.getElementById('editContent').style.display='none';
document.getElementById('columnDetails').style.display='';
}
</td>
</tr>
</table>
<?php
}
?>
</div>
The div to be replaced is
<div id="editContent" style="display: none;" >
<form>
Column Name:
<input type="text" name="ColumnName" value="<?php echo $info['instiname'] ; ?>" />
</form>
</div>
Now help me to pass the id of the column name selected/clicked to the edit form.
Thanks & Regards,
Passion Coder.