Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2012, 09:56 AM   PM User | #1
john6
New Coder

 
Join Date: Sep 2012
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
john6 is an unknown quantity at this point
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
john6 is offline   Reply With Quote
Old 10-12-2012, 03:14 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,387
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
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.

Last edited by sunfighter; 10-12-2012 at 03:20 PM..
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:25 PM.


Advertisement
Log in to turn off these ads.