Jump to content

[SOLVED] php, javascript, html forms


FireDrake

Recommended Posts

Hi, I've got a few forms with a href in it all on one page. When you click this href, you will go to the page with

method='GET'

. Later in the script, I use the

if (isset ($_GET['name'])). 

and the user will get the page he asked for. I want to ask how to get these href's to work without using forms. The form I have at this time is:

 

<html>
<head>
	<link rel="stylesheet" type="text/css" href="/css.css"/>
	<style type="text/css"> 
		form { 
			margin-top: -1em;
			margin: 0px; 
			padding: 0px; 
		} 
		input {
			margin: 0px; 
			padding: 0px; 
		} 
		input.hidden { 
			display: none; 
		}
	</style>
</head>
<body>
<div class="c" style="position:absolute">
		<form name="home" method="GET">
			<input type=hidden name=link value=home class=hidden>
			<A href="javascript: document.home.submit()">Home</A> |
		</form>	
		<form name="wedstrijden" method="GET">
			<input type=hidden name=link value=wedstrijden class=hidden>
			<A href="javascript: document.wedstrijden.submit()">Wedstrijden</A> |
		</form>
		<form name="stemmen" method="GET">
			<input type=hidden name=link value=stemmen class=hidden>
			<A href="javascript: document.stemmen.submit()">Stemmen</A>
		</form>
	</div>
<?php

if (isset ($_GET['home']))
	{
		echo "<br /><br />the Page here";
	}
if (isset ($_GET['wedstrijden']))
	{
		echo "<br /><br /> another page here";
	}
if (isset ($_GET['stemmen']))
	{
		echo "<br /><br /> another page here";
	}
else {
	echo "no page";
}
?>
</body>
</html>

 

I want the url linking to the right page in first place, and I don't want the forms with a break between each form. Because now all of my hrefs are horizontal instead of vertical next to each other.

Can anyone please help me? Im stuck with this script for hours now.

Link to comment
Share on other sites

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="/css.css"/>
      <style type="text/css"> 
        form { 
          margin-top: -1em;
          margin: 0px; 
          padding: 0px; 
        } 
        input {
          margin: 0px; 
          padding: 0px; 
        } 
          input.hidden { 
          display: none; 
        }
      </style>
    </head>
    <body>
      <div class="c" style="position:absolute">
        <a href="?link=home">Home</a>
        <a href="?link=wedstrijden">Wedstrijden</a>
        <a href="?link=stemmen">Stemmen</a>
      </div>
<?php

  if (isset($_GET['link'])) {
    switch ($_GET['link']) {
      case "home":
        echo "<br /><br />the Page here";
        break;
      case "wedstrijden":
        echo "<br /><br /> another page here";
        break;
      case "stemmen":
        echo "<br /><br /> another page here";
        break;
      default:
        echo "no page";
    }
  } else {
    echo "no page";
  }

?>
  </body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.