Connecting Tech Pros Worldwide Forums | Help | Site Map

passing a variable from a form to php

bawar
Guest
 
Posts: n/a
#1: Jul 17 '05
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_register('language');

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

$result = mysql_query("SELECT * FROM languages ORDER BY mylanguage");
if (!$result) {
echo("<P><b>Fout bij uitvoeren query: </b>" .
mysql_error() . "</P>");
exit();
}
echo("<FORM ACTION='$PHP_SELF' METHOD='POST'><INPUT TYPE='hidden'
NAME='toevoegen' VALUE='1'>");
while (($row = mysql_fetch_array($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
Guest
 
Posts: n/a
#2: Jul 17 '05

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_register('language');
>
> echo("Taal is $language <p/>");
> echo("Toevoegen=$toevoegen <p/>");
> if (!IsSet($language)){
>
> $result = mysql_query("SELECT * FROM languages ORDER BY mylanguage");
> if (!$result) {
> echo("<P><b>Fout bij uitvoeren query: </b>" .
> mysql_error() . "</P>");
> exit();
> }
> echo("<FORM ACTION='$PHP_SELF' METHOD='POST'><INPUT TYPE='hidden'
> NAME='toevoegen' VALUE='1'>");
> while (($row = mysql_fetch_array($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_globals...
http://us3.php.net/manual/en/securit...terglobals.php

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

Closed Thread