By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,516 Members | 1,369 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,516 IT Pros & Developers. It's quick & easy.

adding column and retrieval data from database

P: 18
i need help on one of my website page....

this is my coding...

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. if(isset($_SESSION ['username']))
  4. {
  5. ?>
  7. <html>
  8. <body>
  9. Hi, <?php echo $_SESSION['username']; ?> [<a href="logout.php">Logout</a>]
  10. <br><br>
  11. <?php echo    "SENARAI TUGAS HARIAN"; ?>
  12. <br><br>
  13. <table width="877" border="1">
  14. <tr>     
  15.     <td height="23" colspan="4" valign="top" border:0px;> &nbsp;&nbsp;&nbsp;NAMA &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <?php echo $_SESSION['username']; ?></td> 
  16.   </tr>
  17.     <tr>
  18.       <td height="23" colspan="4" valign="top"> &nbsp;&nbsp;&nbsp;JAWATAN &nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      </td> 
  19.     </tr>
  20.     <tr> 
  21.      <td width="40" height="23" valign="top">&nbsp;&nbsp;&nbsp;BIL </td> 
  22.      <td width="111" valign="top">&nbsp;&nbsp;&nbsp;TARIKH</td>
  23.      <td width="545" valign="top">&nbsp;&nbsp;&nbsp;TUGAS SAYA HARI INI </td> 
  24.      <td width="153" valign="top">&nbsp;&nbsp;&nbsp;CATATAN </td> 
  25.   </tr>
  26. </table>
  27. <br><br>
  29. </body>
  30. </html>
  32. <?php
  33. }
  34. else{
  35. header("Location: login.php");
  36. }
  37. ?>
this coding will display a table.....i would like to ask for anyone's help on adding row after we enter a data...i would like to fill the data entered in the specified column.....the data will keep being entered in the page each time after we enter the data on the other page......someone please help me......
any suggestion would help....
Jan 13 '12 #1
Share this Question
Share on Google+
5 Replies

Expert Mod 10K+
P: 12,359
I don't understand what you're actually looking for but if you're trying to add a table row on the client side, then use javascript to access the DOM and add a row.
Jan 13 '12 #2

P: 18
rabbit:what i mean is,when we enter data in a page,then the data will be entered to this table automatically......after we add another data, the data then continue being inserted into the it possible for me to do that by using php?
Jan 16 '12 #3

Expert Mod 10K+
P: 12,359
With just PHP? Sure, when they submit the new row, store the data in a database and reload it from the database.
Jan 16 '12 #4

P: 18
i can retrieve the data from database, but the problem is, i need to hit F5 button to retrieve the new data....i want this program to automatically insert data to table after we add data from another page
Jan 17 '12 #5

Expert Mod 10K+
P: 12,359
You mean if you have two pages open? Use AJAX to refresh the data every so often.
Jan 17 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.