dynamic html tables based on link clicked

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
ryan1987
Forum Newbie
Posts: 16
Joined: Tue Dec 22, 2009 10:45 am

dynamic html tables based on link clicked

Post by ryan1987 »

hi

i am creating a webpage with a menu down the left hand side. depending on which link in the menu you click a table on the right of will show the relavent information. the table will show the relavent information from a mysql table based on the link clicked.

i have found that i can do this using javascript. my form looks like this:

Code: Select all

 
 
<form name="form" method="post" action="processpage.php" >
                <li> <h3> links</h3>
                    <ul>
                        <li><a name="link1" href="javascript&#058; void(1);" onClick="submitForm('link1');">like1</a></li>
 
this javascript code submits the form to the processpage:

Code: Select all

 
function submitform()
            {
                document.form.submit();
            }
 


but on the process page i do to make sure the link that is being clicked a passed to the process page: <?php print $_POST["form"]; ?>

put it doesnt print anything i get an error:

Notice: Undefined index: submit in C:\wamp\www\processpage.php on line 31
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: dynamic html tables based on link clicked

Post by kaszu »

There is no input with name "submit" in your form.
ryan1987
Forum Newbie
Posts: 16
Joined: Tue Dec 22, 2009 10:45 am

Re: dynamic html tables based on link clicked

Post by ryan1987 »

i am unsure what to change to make it work. please help me
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: dynamic html tables based on link clicked

Post by kaszu »

Do you really need to use POST? Here's how it would be using GET:

Code: Select all

<a name="link1" href="processpage.php?link=1">like1</a>

Code: Select all

<?php print $_GET["link"]; ?>
Though for this I would require at least 3-4 days time.
Is that a joke?
Post Reply