Edit Tool

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jay87
Forum Commoner
Posts: 61
Joined: Thu Jan 07, 2010 5:22 am

Edit Tool

Post by Jay87 »

I have the following table: where people input new calls:

Code: Select all

<table width=100% height=100% cellspacing=0 cellpadding=5>
    <tr>
    <td valign=top>
            <br>
            <table cellpadding=0 cellspacing=0 border=0><tr><td>
            <table width=800 cellspacing=1 cellpadding=0 class=smooth>
            <form method='post'>
            <tr class=smooth><th colspan=2><table width=100% cellspacing=0 cellpadding=0><th class=smooth_title colspan=1 id=subtitle width=250px>Edit Call</th><th align=center class=smooth_title><? echo "<b>" . $company['company'] . "</th><th align=right class=smooth_title>" . $_SESSION['pfx']  . $nt;?></th></tr></table></th></tr>
            <tr><th class='smooth' style="width:250px;">User</th>
            <th class='smooth' style="width:250px;text-align:right">Subject</th>
            </tr>
            <tr><th><input style="width:250px;" name='user'/></th><td class=smooth width=100% colspan=1><input id='desc' name='desc' style="width:100%;"/></td></tr>
            <tr><th class='smooth' style="width:250px;">Engineer</th><th class='smooth' style="width:250px;text-align:right;">Details</th></tr>
            <tr><td class='menu_item'><select style="width:250px;" name='engid'>
            <?
          $result = mssql_query("SELECT id,(forename + ' ' + surname) as name FROM engineer WHERE enabled=1 ORDER BY id ASC",$db);
          while ($item = mssql_fetch_array($result)){
           
    $entry = mssql_fetch_array($result);
           echo "<option ";
            if ($_POST['engineer']==$item['id']){echo " selected ";}
            if ($_SESSION['level']<10 && $item['id']!=1){echo " disabled";}
            echo " value='" . $item['id'] . "'>" . $item['name'] . "</option>";
          }
        ?></select></th><td class=smooth rowspan=12 style="vertical-align:top;" colspan=1> <textarea name='details' rows=13 style="width:100%;"></textarea></td></tr>
            <tr><th class='smooth' style="width:250px;">Queue</th></tr>
            <tr><td class='menu_item'><select style="width:250px;" name='queue'>
            <?
          $result = mssql_query("SELECT id,description FROM queue ORDER BY id ASC",$db);
          while ($item = mssql_fetch_array($result)){
            echo "<option ";
            if ($_POST['queue']==$item['id']){echo " selected ";}
            if ($_SESSION['level']<10 && $item['id']!=1){echo " disabled";}
            echo " value='" . $item['id'] . "'>" . $item['description'] . "</option>";
          }
        ?></select></th></tr>
            <tr><th class='smooth' style="width:250px;">Chargeable</th></tr>
            <tr><td class='menu_item'><select style="width:250px;" name='charge'><option value='0'>No</option><option value='1'>Yes</option></select></th></tr>
            <tr><th class='smooth' style="width:250px;">Fault Type</th></tr>
            <tr><td class='menu_item'><select style="width:250px;" name='type'>
            <?
        $result = mssql_query("SELECT id,name FROM calltype ORDER BY name ASC",$db);
        while ($item = mssql_fetch_array($result)){
          echo "<option ";
          if ($_POST['type']==$item['id']){echo " selected ";}
          echo "value='" . $item['id'] . "'>" . $item['name'] . "</option>";
        }?></select></th></tr>
            <tr><th class='smooth'>Priority</th></tr>
            <tr><td class='menu_item'><select style="width:250px;" name='pri' id='pri'>
        <option value='1'>High</option>
        <option value='2' selected>Normal</option>
    <!--    <option value='3'>Low</option>
        <option value='4'>Work Request</option> -->
        </select></td></tr>
            <tr><th class='smooth'>Status</th></tr>
            <tr>
        
        <td class='menu_item'><select style="width:250px;" name='status'>
        <?$result = mssql_query("SELECT id,name FROM callstatus ORDER BY id ASC",$db);
        while ($item = mssql_fetch_array($result)){
          echo "<option ";
          echo "value='" . $item['id'] . "'>" . $item['name'] . "</option>";
        }?>
        </select></td></tr>
        
        <input type='hidden' name='id' value='<? echo $nt;?>'/>
            </form>
            </table>
      </td></tr><tr><td>&nbsp;</td></tr><tr><td align=center><button class=flat2 onclick="window.onbeforeunload=null;if(document.forms[0].desc.value=='' || document.forms[0].user.value=='' || document.forms[0].details.value==''){alert('Missing valid fields (Subject, Details or User)');return false;} else {document.forms[0].submit();return false;}">Edit Call</button><button class=flat2 onclick="window.onbeforeunload=null;document.location='log_be.php?cancel=1&id=<? echo $nt . "&pfx=" . $_SESSION['prefix'];?>'";>Cancel Call</button></td></tr>
      </table>
        </td><td valign=top align=center style="width:50%;border-top:0px dotted black;border-bottom:1px solid cccccc; border-right:1px solid #DADADA;">
            <br>
        
        </table>
        </td>
    </tr>
</table>
These details can then be viewed on the helpdesk....

What i want to do is add an edit option so you can click an image when viewing the details and it will load up all the details from that call....

Any ideas on how i can do this?
Post Reply