1

I'm having an issue where when i attempt to post a form, I'm missing data. I thought initially it could be because some jquery magic that I'm playing with ... but as a test, I created (via PHP) an input box with a dummy value and made sure it's within the form tag. when I click on the submit button, I can see in the post data that this input field is not included.

Here's relevant the HTML from "view source":

<tr>
    <td>
        <a href="index.php?module=redirect&page=rackspace&tab=editrows&op=deleteRow&row_id=17" title="Delete row" class="input">
            <img src='?module=chrome&uri=pix/tango-user-trash-16x16.png' width=16 height=16 border=0 title='Delete row'>
        </a>
    <form method=post id=updateRow name=updateRow action='?module=redirect&page=rackspace&tab=editrows&op=updateRow'>
        <input type=hidden name="row_id" value="17">
    </td>
    <td>
        <div id="location_name">canada</div>
        <input type=hidden id=location_id value=15>
    </td>
    <td>
        <div id=name name=name value='can-room 12'>can-room 12</div>
    </td>
    <td>
        <input type=image name=edit class=edit src='?module=chrome&uri=pix/pencil-icon.png' id='15' border=0  title='Edit row'>&nbsp;
        <input value=123 id=test>
        <input type=image name=submit class=icon src='?module=chrome&uri=pix/tango-document-save-16x16.png' border=0  title='Save changes'>
    </form>
    </td>
    <td>
        <a href="index.php?page=row&row_id=17">Row can-room 12</a>
    </td>
</tr>

And this is what I end up with in the form POST data as per F12 tools:

row_id=17&submit.x=8&submit.y=10

I can't figure out why it doesn't include the "test" input and also the hidden location_id input. All the fields are inside the form tags... albeit the form location isn't ideal

Any suggestions?

dot
  • 14,928
  • 41
  • 110
  • 218
  • no name attributes. Plus, do quote everything. Some browsers will not like that. – Funk Forty Niner Oct 21 '15 at 20:40
  • I'd argue this isn't duplicate. Perhaps same cause but the error/problem is distinctly different and nothing related to PHP parsing input data - rather why the POST payload excludes the data. – developerjack Oct 21 '15 at 20:55

1 Answers1

3

Your missing test input field is using id not name. Forms will submit elements based off the element name.

Try instead: <input value=123 id="test" name="test"> so you get both the id and the name.

Similarly: <input type=hidden id="location_id" name="location_id" value=15>

edit: added the location_id field too

developerjack
  • 1,173
  • 6
  • 15
  • `type` is not a required field. Acording to the [W3 standard](http://www.w3.org/TR/html-markup/input.html#input) "An input element with no type attribute specified represents the same thing as an input element with its type attribute set to "text"." – developerjack Oct 21 '15 at 20:49