Jump to content

[SOLVED] load content from link withouth ajax


jesushax

Recommended Posts

hi i was wondering if in php we can load content from alink into our page without ajax or frames etc just php

 

for example

 

Username:

Geoff

Bill

Fred

 

So i click Geoff and then a form below is shown with geoffs info on, the form can be from another page or if need be ill put it on the same page in a function or something, is this easy and do able in php?

Of course. This is the basics of dynamic web development.

 

<?php

  if (!isset($_GET['user'])) {
    echo "Username:<br />";
    echo "<a href='?user=geoff'>Geoff</a><br />";
    echo "<a href='?user=bill'>Bill</a><br />";
    echo "<a href='?user=fred'>Fred</a><br />";
  } else {
    switch ($_GET['user']) {
      case 'geoff':
        echo "This is Geoff's information";
        break;
      case 'bill':
        echo "This is Bill's information";
        break;
      case 'Fred':
        echo "This is Fred's information";
        break;
      default:
        echo "User not found";
    }
  }

?>

 

The information within the switch can come from wherever you like, be it a database query or a seperate file. I just hardcoded as an example.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.