0

I have a form that I am trying to create a link to insert a new record within a dynamic table I am able to accuratly do this with a form as below using a submit button

<tr>
    <form method="POST" action="<?php echo $editFormAction; ?>" name="submitOption" id="submitOption">
        <td class="tdInvisible"><?php echo $row_allQuestionOptionUser['optionKey']; ?><input name="optionKeyHidden" type="hidden" value=<?php echo $row_allQuestionOptionUser['optionKey']; ?> /></td>
        <td class="tdInvisible"><?php echo $row_allQuestionOptionUser['questionKey']; ?><input name="questionKeyHidden" type="hidden" value=<?php echo $row_allQuestionOptionUser['questionKey']; ?> /></td>
        <td class="tdInvisible"><?php echo $userKey; ?><input name="userKeyHidden" type="hidden" value=<?php echo $userKey; ?> /></td>
        <td><input name="test" type="submit" /></td>
    <input type="hidden" name="MM_insert" value="submitOption" />
    </form>
</tr>

but when I try to use the following code it only inserts with the value of the first record using the "javascript:document.forms[0].submit();"

<tr>
    <form method="POST" action="<?php echo $editFormAction; ?>" name="submitOption" id="submitOption">
        <td class="tdInvisible"><?php echo $row_allQuestionOptionUser['optionKey']; ?><input name="optionKeyHidden" type="hidden" value=<?php echo $row_allQuestionOptionUser['optionKey']; ?> /></td>
        <td class="tdInvisible"><?php echo $row_allQuestionOptionUser['questionKey']; ?><input name="questionKeyHidden" type="hidden" value=<?php echo $row_allQuestionOptionUser['questionKey']; ?> /></td>
        <td><a href="javascript:document.forms[0].submit();"><?php echo $row_allQuestionOptionUser['optionText']; ?></a></td>
        <td class="tdInvisible"><?php echo $userKey; ?><input name="userKeyHidden" type="hidden" value=<?php echo $userKey; ?> /></td>
    <input type="hidden" name="MM_insert" value="submitOption" />
    </form>
</tr>

Any help would be appreciated

Edited by honkyno1

1
Contributor
1
Reply
11
Views
4 Years
Discussion Span
Last Post by honkyno1
1

I ended up just using the submit button, but passed the field value to the button value and used CSS to style to my desired effect

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.