Jump to content

[SOLVED] passing a parameter from an HTML page to a PHP page


Johnain

Recommended Posts

can I do this?  I want to pass a language value (EN/FR/DE etc.) from an Index HTML page to a PHP page with a language code in the call, so that the PHP page can select texts in that language. I would like to to it from an unordered list item if possible by extending the link ...

 

<li><a href="scripts/pricelist.php??????????????????>Pricelist</a></li>

Link to comment
Share on other sites

can I do this?  I want to pass a language value (EN/FR/DE etc.) from an Index HTML page to a PHP page with a language code in the call, so that the PHP page can select texts in that language. I would like to to it from an unordered list item if possible by extending the link ...

 

<li><a href="scripts/pricelist.php>Pricelist</a></li>

 

Sorry about the dodgy faces. I thought I was just putting question marks in.

Link to comment
Share on other sites

Of course...

 

<li><a href="scripts/pricelist.php?lan=en>English Pricelist</a></li>
<li><a href="scripts/pricelist.php?lan=fr>French Pricelist</a></li>

 

pricelist.php

<?php

  if (isset($_GET['lan'])) {
    switch ($_GET['lan']) {
      case 'en':
        // english list
        break;
      case 'fr':
        // french list
        break;
    }
  }

?>

Link to comment
Share on other sites

Of course...

 

<li><a href="scripts/pricelist.php?lan=en>English Pricelist</a></li>
<li><a href="scripts/pricelist.php?lan=fr>French Pricelist</a></li>

 

pricelist.php

<?php

  if (isset($_GET['lan'])) {
    switch ($_GET['lan']) {
      case 'en':
        // english list
        break;
      case 'fr':
        // french list
        break;
    }
  }

?>

 

Thank you very much.

 

It's a steep learning curve for me, but I am enjoying it.

 

Regards

 

John

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.