By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,677 Members | 1,890 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,677 IT Pros & Developers. It's quick & easy.

passing a variable from a form to php

P: n/a
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 !");
}
?>
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
bawar wrote:
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 !");
}
?>


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 - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.