Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Passing on Javascript array data to a PHP-array

Passing on Javascript array data to a PHP-array

Scheduled Pinned Locked Moved JavaScript
helpjavascriptphphtmldatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gert Koetsier
    wrote on last edited by
    #1

    I found and adapted an HTML script as shown below. It fits my needs perfectly. However, I don't know how to store the field-values of repeated lines in a javascript array that subsequently passes its contents on to a PHP-array that enables me to store the date in a MYSQL-database. I tried to fix something myself in de 3rd codeblock of de AddRow()function. A second problem is: when de line is repeated I need to reset de field values to default. Does anybody have the knowledge that I so obviously do not have? ====================================================================== function AddRow () { var o_id = document.getElementById ("id").cloneNode(true); var label_id = document.getElementById ("label_id").cloneNode(true); var o_item = document.getElementById ("item").cloneNode(true); var o_subitem = document.getElementById ("subitem").cloneNode(true); var label_opm = document.getElementById ("label_opm").cloneNode(true); var o_opm = document.getElementById ('opm').cloneNode(true); // reset field opm document.getElementById("opm").innerHTML=""; o_id.name='id[]'; o_item.name = 'item[]'; o_subitem.name = 'subitem[]'; o_opm.name = 'opm[]'; var o_button = document.createElement ("input"); o_button.type = "button"; o_button.value = "Remove"; o_button.onclick = RemoveRow; var o_td_id = document.createElement ("td"); var o_td_item = document.createElement ("td"); var o_td_subitem = document.createElement ("td"); var o_td_opm = document.createElement ("td"); var o_td_button = document.createElement ("td"); var o_tr = document.createElement ("tr"); var o_body = document.getElementById ("dynamic_table_body"); o_td_id.appendChild (label_id); o_td_id.appendChild (o_id); o_td_item.appendChild (o_item); o_td_subitem.appendChild (o_subitem); o_td_opm.appendChild (label_opm); o_td_opm.appendChild (o_opm); o_td_button.appendChild (o_button); o_tr.appendChild (o_td_id); o_tr.appendChild (o_td_item); o_tr.appendChild (o_td_subitem); o_tr.appendChild (o_td_opm); o_</x-turndown>

    E 1 Reply Last reply
    0
    • G Gert Koetsier

      I found and adapted an HTML script as shown below. It fits my needs perfectly. However, I don't know how to store the field-values of repeated lines in a javascript array that subsequently passes its contents on to a PHP-array that enables me to store the date in a MYSQL-database. I tried to fix something myself in de 3rd codeblock of de AddRow()function. A second problem is: when de line is repeated I need to reset de field values to default. Does anybody have the knowledge that I so obviously do not have? ====================================================================== function AddRow () { var o_id = document.getElementById ("id").cloneNode(true); var label_id = document.getElementById ("label_id").cloneNode(true); var o_item = document.getElementById ("item").cloneNode(true); var o_subitem = document.getElementById ("subitem").cloneNode(true); var label_opm = document.getElementById ("label_opm").cloneNode(true); var o_opm = document.getElementById ('opm').cloneNode(true); // reset field opm document.getElementById("opm").innerHTML=""; o_id.name='id[]'; o_item.name = 'item[]'; o_subitem.name = 'subitem[]'; o_opm.name = 'opm[]'; var o_button = document.createElement ("input"); o_button.type = "button"; o_button.value = "Remove"; o_button.onclick = RemoveRow; var o_td_id = document.createElement ("td"); var o_td_item = document.createElement ("td"); var o_td_subitem = document.createElement ("td"); var o_td_opm = document.createElement ("td"); var o_td_button = document.createElement ("td"); var o_tr = document.createElement ("tr"); var o_body = document.getElementById ("dynamic_table_body"); o_td_id.appendChild (label_id); o_td_id.appendChild (o_id); o_td_item.appendChild (o_item); o_td_subitem.appendChild (o_subitem); o_td_opm.appendChild (label_opm); o_td_opm.appendChild (o_opm); o_td_button.appendChild (o_button); o_tr.appendChild (o_td_id); o_tr.appendChild (o_td_item); o_tr.appendChild (o_td_subitem); o_tr.appendChild (o_td_opm); o_</x-turndown>

      E Offline
      E Offline
      Evan Gallup
      wrote on last edited by
      #2

      I'd love to help, but I'm really not clear as to what you're asking here. Can you explain further? Also, just a tip, put any code you must share inside of these tags: <pre></pre> Do so by clicking the 'code' button above the message box. It makes your code a lot easier to read.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups