change content of the table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • idorjee
    New Member
    • Mar 2007
    • 76

    change content of the table

    hi,
    is there any way i could click on the html table content (<td>) and edit the info, and then click a button to update the modification into a database?
    i found the following function off the internet, and it really doesn't do the thing that mentioned above, but just replaces the content with the specified "WORD".

    Code:
    function changeContent(){
        var x=document.getElementById('myTable').rows
        var y=x[0].cells
        y[0].innerHTML="NEW CONTENT"
    }
    please help. thanks a lot in advance.
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    why don't you put the contents of the <td> into a text field

    [PHP]
    <td><input type="text" name="nameGoesH ere" value="Value Here" /></td>

    [/PHP]

    You don't like the looks of it you say? want it to look like regular text?

    You can completely change the look of an input tag with css.

    background color, no border would do the trick for you.

    " Google input html css "

    Comment

    • idorjee
      New Member
      • Mar 2007
      • 76

      #3
      hi dlite922,
      thanks for your reply. i tried that already and doesn't work. here is what i'm actually doing:
      the script gets the $desc (string) from somewhere, and
      Code:
      echo "<TR bgcolor=\"#660000\"><TD COLSPAN=2><input type=\"text\" name=\"desc\" value=\"$desc\" /></TD></TR>";
      the next thing that i'm trying to do is to submit the $desc variable, AFTER making some changes to it, to another script that would insert it into the database:
      Code:
      echo "<form name=\"go\" method=\"post\" action=\"ezadd.php\">";
      echo "<input type=\"hidden\" name=\"desc\" value=\"$desc\">";
      echo "<input type=\"submit\" name=\"submit\" value=\"Add to DB\">";
      Thank you!

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by idorjee
        the next thing that i'm trying to do is to submit the $desc variable, AFTER making some changes to it, to another script that would insert it into the database:
        Without refreshing the page?

        Comment

        Working...