SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    To save Multiple div values with the same name using php and mysql

    How to save multipple div values with the content editable feature with the same name in database using php.

    The user can click the div element as many times as he/she wants and can enter the values in the text boxes(that is a small div boxes). Once the user clicks the submit button, all the values that he/she entered should be saved in the database.

    I have written code like this to display the box and was working fine.
    $board.append('<div class="class1" style="left:20px;top:70px"><div contenteditable class="editable" name = "content[]"></div></div>');

    and the next code with be with a different class outside but the same name inside.

    $board.append('<div class="class2" style="left:20px;top:70px"><div contenteditable class="editable" name = "content[]"></div></div>');

    The user can create as many div values as he/she wants.

    How to call these values in array using php and save it in the database.

    I was able to do the same with the text values with the name of the text box, but when i tried to do the same, i could not run it and was showing error.

    I would be glad if somebody could help me out with code.

  2. #2
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    You'll need to copy the values from the contenteditable divs into a form input (probably a textarea is best) before submitting the form.

    Then, you can access them using the $_POST superglobal.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •