Jump to content

edit button


austine_power007

Recommended Posts

I have a table i made it by fetching from the database its like

Job title --- Start date ----Est. End date-----Act end date-----progress-----remark------------Button
job1            21/10/2006    25/10/2006            28/10/2006        90%        On progress        [b] Edit [/b]
Job2            14/11/2006      16/11/2006          20/11/2006        100%        Completed          [b] Edit[/b]

When user click edit on a selected row it only make that row editable ....how can i do that ???

Help me please
Link to comment
https://forums.phpfreaks.com/topic/30440-edit-button/
Share on other sites

[code]
$result=@mysql_query("SELECT * FROM `jobs` WHERE `title`='{$_GET['job_title']}'",$cn) or die(mysql_error());

echo "<form method=\"post\" action=\"edit_job.php\">";
while($row=mysql_fetch_array($result))
{
$title=$row['title'];
$start_date=$row['start_date'];
$est_end_date=$row['est_end_date'];
$act_end_date=$row['act_end_date'];
$pro=$row['progress'];
$remark=$row['remark'];

echo "<p><input type=\"text\" name=\"title\" value=\"{$title}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"start_date\" value=\"{$start_date}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"est_end_date\" value=\"{$est_end_date}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"act_end_date\" value=\"{$act_end_date}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"pro\" value=\"{$pro}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"remark\" value=\"{$remark}\"><b>Job title</b></p><p><input type=\"submit\"></form>";
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30440-edit-button/#findComment-140179
Share on other sites

I think i give u the code for better understanding.

[code]<?    //Task list show in the profile
        include("connect_db.php");
        $name=($_SESSION["name"]);
        $query = odbc_exec($odbc, "SELECT * FROM task WHERE dev_name = '$name' ") or die ("Wrong data");
//$task = odbc_exec($odbc, "SELECT  FROM task WHERE dev_name = '$name' ") or die ("Wrong data");


echo"
<tr>
  <td width='139' height='26' align='center' valign='middle' class='style12'>Job Title </td>
                  <td width='80' align='center' valign='middle' class='style12'>Start Date </td>
                  <td width='94' align='center' valign='middle' class='style12'>Est. End Date </td>
                  <td width='91' align='center' valign='middle' class='style12'>Act. End Date </td>
                  <td width='74' align='center' valign='middle' class='style12'>Completed</td>
                  <td width='237' align='center' valign='middle' class='style12'>Remarks</td>
</td>
  </tr>
  ";
 
 
while($row = odbc_fetch_array($query))
{
            $titl = ($row['title']);
$start_dat = ($row['start_date']);
$start = date("d/m/y", strtotime($start_dat));
$est_end_date = ($row['est_end_date']);
$end = date("d/m/y", strtotime($est_end_date));
$actual_end_date = ($row['actual_end_date']);
$actual = date("d/m/y", strtotime($actual_end_date));
$complete = ($row['complete']);
$remark = ($row['remark']);


if(odbc_num_rows($query)== 0)
echo"No Data";
    elseif(($complete)<100)
    {
    if(($complete)>50 and ($complete) <100)
{
echo"
  <tr> 
    <td style=color:blue width='139' height='26'><div align='left'><strong>$titl</strong></dv></td>
    <td style=color:blue width='80'><div align='center'><strong>$start</strong></dv></td>
    <td style=color:blue width='94'><div align='center'><strong>$end</strong></dv></td>
    <td style=color:blue width='91'><div align='center'><strong>$actual</strong></dv></td>
    <td style=color:blue width='74'><div align='center'><strong>$complete%</strong></dv></td>
<td style=color:blue width='237'><div align='left'><strong>$remark</strong></dv></td>
        <td width="260" align="center" valign="middle"><label>Edit</label></td>

  </tr>
   
 
"; 
}
elseif(($complete)<=50)
{
echo"
  <tr> 
    <td style=color:red width='139' height='26'><div align='left'><strong>$titl</strong></dv></td>
    <td style=color:red width='80'><div align='center'><strong>$start</strong></dv></td>
    <td style=color:red width='94'><div align='center'><strong>$end</strong></dv></td>
    <td style=color:red width='91'><div align='center'><strong>$actual</strong></dv></td>
    <td style=color:red width='74'><div align='center'><strong>$complete%</strong></dv></td>
<td style=color:red width='237'><div align='left'><strong>$remark</strong></dv></td>
      <td width="260" align="center" valign="middle"><label>Edit</label></td>

  </tr>
"; 
}  
elseif(($complete)==100)
{
echo"
  <tr> 
    <td style=color:green width='139' height='26'><div align='left'><strong>$titl</strong></dv></td>
    <td style=color:green width='80'><div align='center'><strong>$start</strong></dv></td>
    <td style=color:green width='94'><div align='center'><strong>$end</strong></dv></td>
    <td style=color:green width='91'><div align='center'><strong>$actual</strong></dv></td>
    <td style=color:green width='74'><div align='center'><strong>$complete%</strong></dv></td>
<td style=color:green width='237'><div align='left'><strong>$remark</strong></dv></td>
    <td width="260" align="center" valign="middle"><label>Edit</label></td>
  </tr>
"; 
}
else
{
        echo "
  <tr> 
    <td width='139' height='26'><div align='left'><strong>$titl</strong></dv></td>
    <td width='80'><div align='center'><strong>$start</strong></dv></td>
    <td width='94'><div align='center'><strong>$end</strong></dv></td>
    <td width='91'><div align='center'><strong>$actual</strong></dv></td>
    <td width='74'><div align='center'><strong>$complete%</strong></dv></td>
<td width='237'><div align='left'><strong>$remark</strong></dv></td>
    <td width="260" align="center" valign="middle"><label>Edit</label></td>
  </tr>

</table>";
}
}
 
}
?>  [/code]

Here is the whole code that create table
Link to comment
https://forums.phpfreaks.com/topic/30440-edit-button/#findComment-140185
Share on other sites

[quote author=fert link=topic=118401.msg483848#msg483848 date=1165984485]
[code]
$result=@mysql_query("SELECT * FROM `jobs` WHERE `title`='$job_title'",$cn) or die(mysql_error());

echo "<form method=\"post\" action=\"edit_job.php\">";
while($row=mysql_fetch_array($result))
{
$title=$row['title'];
$start_date=$row['start_date'];
$est_end_date=$row['est_end_date'];
$act_end_date=$row['act_end_date'];
$pro=$row['progress'];
$remark=$row['remark'];

echo "<p><input type=\"text\" name=\"title\" value=\"{$title}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"start_date\" value=\"{$start_date}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"est_end_date\" value=\"{$est_end_date}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"act_end_date\" value=\"{$act_end_date}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"pro\" value=\"{$pro}\"><b>Job title</b></p>";
echo "<p><input type=\"text\" name=\"remark\" value=\"{$remark}\"><b>Job title</b></p><p><input type=\"submit\"></form>";
}
[/code]
[/quote]
Can you please give me a little description about this code i am dumb in PHP :(
Link to comment
https://forums.phpfreaks.com/topic/30440-edit-button/#findComment-140186
Share on other sites

do do what you want the button needs to have the following format
[code]
<input type=\"get\" action=\"edit.php\"><input type=\"hidden\" name=\"job_title\" value=\"job name\"><input type=\"submit\">
[/code]
Then when you use the code i've posted it will only show the row that has that job name.
Link to comment
https://forums.phpfreaks.com/topic/30440-edit-button/#findComment-140192
Share on other sites

[quote author=fert link=topic=118401.msg483863#msg483863 date=1165985412]
do do what you want the button needs to have the following format
[code]
<input type=\"get\" action=\"edit.php\"><input type=\"hidden\" name=\"job_title\" value=\"job name\"><input type=\"submit\">
[/code]
Then when you use the code i've posted it will only show the row that has that job name.
[/quote]

this is like i think one kind of search user give the job title then click the button then it search then show result right??
Link to comment
https://forums.phpfreaks.com/topic/30440-edit-button/#findComment-140200
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.