Jump to content

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.

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.