passing a variable from a form to php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bawar

    passing a variable from a form to php

    Hellow,

    I don't seem to be able to send trough the variable 'language' from my
    form to the php-variable $language that I want to use in my session...
    I first tried in the form with a drop down menu (select) and now with
    radio-buttons but it won't work... What am I doing wrong?
    BTW: the variable 'toevoegen' is passed correctly from the form to the
    php.

    <?php

    session_start() ;
    session_registe r('language');

    echo("Taal is $language <p/>");
    echo("Toevoegen =$toevoegen <p/>");
    if (!IsSet($langua ge)){

    $result = mysql_query("SE LECT * FROM languages ORDER BY mylanguage");
    if (!$result) {
    echo("<P><b>Fou t bij uitvoeren query: </b>" .
    mysql_error() . "</P>");
    exit();
    }
    echo("<FORM ACTION='$PHP_SE LF' METHOD='POST'>< INPUT TYPE='hidden'
    NAME='toevoegen ' VALUE='1'>");
    while (($row = mysql_fetch_arr ay($result))){
    echo("<INPUT TYPE='radio' NAME='language' >".$row["mylanguage "]);
    }
    echo("<INPUT TYPE='submit' NAME='kies_taal ' VALUE='Choose
    language...'>") ;
    echo("</FORM>");
    }

    else{
    echo("Uw taal is $language !");
    }
    ?>
  • Justin Koivisto

    #2
    Re: passing a variable from a form to php

    bawar wrote:
    [color=blue]
    > Hellow,
    >
    > I don't seem to be able to send trough the variable 'language' from my
    > form to the php-variable $language that I want to use in my session...
    > I first tried in the form with a drop down menu (select) and now with
    > radio-buttons but it won't work... What am I doing wrong?
    > BTW: the variable 'toevoegen' is passed correctly from the form to the
    > php.
    >
    > <?php
    >
    > session_start() ;
    > session_registe r('language');
    >
    > echo("Taal is $language <p/>");
    > echo("Toevoegen =$toevoegen <p/>");
    > if (!IsSet($langua ge)){
    >
    > $result = mysql_query("SE LECT * FROM languages ORDER BY mylanguage");
    > if (!$result) {
    > echo("<P><b>Fou t bij uitvoeren query: </b>" .
    > mysql_error() . "</P>");
    > exit();
    > }
    > echo("<FORM ACTION='$PHP_SE LF' METHOD='POST'>< INPUT TYPE='hidden'
    > NAME='toevoegen ' VALUE='1'>");
    > while (($row = mysql_fetch_arr ay($result))){
    > echo("<INPUT TYPE='radio' NAME='language' >".$row["mylanguage "]);
    > }
    > echo("<INPUT TYPE='submit' NAME='kies_taal ' VALUE='Choose
    > language...'>") ;
    > echo("</FORM>");
    > }
    >
    > else{
    > echo("Uw taal is $language !");
    > }
    > ?>[/color]

    use $_POST['language'], $_SERVER['PHP_SELF'] $_POST['toevoegen'],
    $_SESSION['language'], etc.

    or, look up register_global s...
    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    --
    Justin Koivisto - spam@koivi.com
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Comment

    Working...