CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   Links not working??? (http://www.codingforums.com/showthread.php?t=276234)

john6 10-12-2012 09:56 AM

Links not working???
 
I have a table where by in each cell there is a form with a link that submits the form.

When I click the link however it does nothing!???

When I have only one form it works fine. But once I have 2 or more forms it doesn't work?

PS: I really do need to have a form for every link because I need to do a _POST on the links - and there's going to be many links as it's generated by PHP.

PHP Code:

<table >
<
thead >
    <
tr>
        <
th>
            
Heading 1
        
</th>
    </
tr>
</
thead>
<
tbody>
    <
tr>
        <
td>
            <
form name="submitForm" action="mylink.php" method="post">
                <
a href="javascript:document.submitForm.submit()">
                    
First
                
</a>
            </
form>
        </
td>
    </
tr>
    <
tr>
        <
td>
            <
form name="submitForm" action="mylink.php" method="post">
                <
a href="javascript:document.submitForm.submit()">
                    
Second
                
</a>
            </
form>
        </
td>
    </
tr>
</
tbody>
</
table


sunfighter 10-12-2012 03:14 PM

forms do not have a 'name' attribute. They have an 'ID' attribute and id's a unique, can only be used once.

Your using javascript to submit the form
Code:

<a href="javascript:document.submitForm.submit()">
But you don't show your script. Why not just use the submit button?
Code:

<table >
<thead >
    <tr>
        <th>
            Heading 1
        </th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>
            <form id="form1" action="mylink.php" method="post">
            <button type="submit" value="PUSH">Submit</button>First
            </form>
        </td>
    </tr>
    <tr>
        <td>
            <form id="form2" action="mylink.php" method="post">
            <button type="submit" value="PUSH">Submit</button>Second
            </form>
        </td>
    </tr>
</tbody>
</table>

Will activate mylink.php, but wont do anything beyond that.


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.