Jump to content

newbiehacker

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

newbiehacker's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. maybe but I know you can do it with php right?
  2. I am trying to fill a text box from a dynamic select box and cant seem to figure it out. My goal is when the user selects a value from select box It creates a query based on the selection and fills my textbox fields. I think I need java script but I a very new at this PLEASE help here is what I have so far[code]function selectDistinct($tablename,$attributename,$dropdownname,$defaultvalue){ global $db; $sql = "SELECT DISTINCT {$attributename} FROM {$tablename}"; $resultID = $db->query($sql); echo "\n<select name=\"{$dropdownname}\">"; while($row = $resultID->fetchRow(DB_FETCHMODE_ASSOC)) { $result = $row[$attributename]; if(isset($defaultvalue)&& $result == $defaultvalue) echo "\n\t<option selected value =\"{$result}\">{$result}"; else echo "\n\t<option value =\"{$result}\">{$result}"; echo "</option>"; } echo "\n</select>"; } echo "Roles: "; selectDistinct("role","extension","roleselect","Add"); ?> <form name="form1" method="post" action= "addRole.php">       <table border="1"  align=center  bgcolor=#EEEEEE>   <td colspan="2" bgcolor=#CCCCCC>         <tr>             <td>RoleName:</td>             <td><input type="text" name="extension" value="<?php echo $result;?>" /></td>         </tr>         <tr>             <td>DND</td>             <td><input type="radio" name="dnd" value="on" />On<input type="radio" checked name="dnd" value="off" />Off</td>         </tr>         <tr>             <td>Paging</td>             <td><input type="radio" name="paging" value="on" />On<input type="radio" checked name="paging" value="off" />Off</td>         </tr> <tr>             <td>P:0</td>             <td><select name="choice0"><option value="dest ">dest</option><option value="dtmf ">dtmf</option></select><input type="text" name="fkey_0"/></td>         </tr>         <tr>             <td>P:1</td>           <td><select name="choice1"><option value="dest ">dest</option><option value="dtmf ">dtmf</option></select><input type="text" name="fkey_1"/></td>[/code]
  3. HI how can you fill a form from a database? I have textboxes and need to pull the data from the database into the textboxes. I know how to create the querys but cant seem to figure out how to get the data into those boxes. PLEASE HELP
  4. sorry, the role is representing the extension field I need to grab whatever is in the dropdown box which is the extension field and populate the form with the other fields related to the extension field
  5. Hi Ill try to keep this short I have a drop down box that is fed by a mysql data base. the code is here. $sql = "select * from role"; $Pass = $db->query($sql); echo '<tr><td>Role:</td><td><select name="role"><option>Add Role</option>'; while($row = $Pass->fetchRow()){ $role = $row[0]; echo '<option value='.$role.'>'.$role.'</option>';     } echo '</select>'; I need to fill a fill a form that has textboxes in which it grabs the value from the dropbox and fills the form with the values in this database here +-----------+------+--------+-----------+-------------+ | extension | dnd  | paging | fkey_0    | fkey_1      | +-----------+------+--------+-----------+-------------+ | default  | off    | on    |          |            | | trial      | off    | on  | dest *123 | dest *124  | | test      | on  | on    | *123      | *123        | | test3    | off  | on    | dest *321 | dtmf ##1123 | +-----------+------+--------+-----------+-------------+ Please help if you can I will be most gratefull
  6. I need to be a little clearer Im not sure how to even fill the text boxes with the data. How do you enter the sql into the textboxes?
  7. Hi I am a newbie programmer and I am stuck with this problem. I need to populate a form (text boxes) when the user selects a value from a dropdown box. here is the code that I am populating the dropdown box with <?php $sql = "select extension from role"; $Pass = $db->query($sql); echo '<tr><td>View Roles :</td><td><select name="role">'; while($Pass->fetchInto($row)){ $id = $row[0]; echo '<option name="role"value='.$id.'>'.$id.'</option>'; } echo '</select>'; ?> here is the mysql data base that i need to populate the textboxes with the extension field is the dropdown box values. I need it so when a user clicks the dropdown box and chooses a extension it fills the textboxes with everything on that row. Any Help Thanks +-----------+------+--------+ | extension | dnd  | paging | +-----------+------+--------+ | default  | off  | on    | | trial    | off  | on    | | test      | off  | on    | | test3    | off  | on    | +-----------+------+--------+
  8. Thank you for the suggestion, but I am quite confused on this self join. Ive looked at many sites and cant find a good example of this can you lend any more input on the situation.
  9. here is a sample of the table. the ip adress does not matter. I use the employees extension for fullname +----------+-------+------------+-------+---------------+ | fullname | inout | timestamp  | notes | ipaddress    | +----------+-------+------------+-------+---------------+ | 200      | out  | 1152219879 | NULL  |              | | 200      | in    | 1152219858 | NULL  |              | | 200      | out  | 1152219659 | NULL  |              | | 200      | in    | 1152219636 | NULL  |              | | 200      | out  | 1152219405 | NULL  |              | | 200      | in    | 1152219385 | NULL  |              | | 200      | out  | 1152219118 | NULL  |              | | 200      | in    | 1152219028 | NULL  |              |
  10. yes, the inout field either holds "in" or "out" and I need to run the cron at around 1:00 in the morning to check which employees if any did not clock out for that day. the timestamp field hold a unix time stamp which is converted in the php timeclock app.
  11. I am using php timeclock and need a way to notify the hr dept if an employee does not clock out at night. My problem is that i cant figure out a way to write the mysql code for the cron job. the database is set up like this fullname|inout|timestamp|notes| I need the sql to find the employees that are still in the "out" status at a certain time. I am a newbie and would be thankful for any help. Thanks
×
×
  • 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.