introduction screenshots faq forum blog modules components download
Please use the search function and/or read the FAQ first.
-->

Notice: Undefined variable



Posted by: bledhuk
February 20, 2010 10:13PM
My error
Notice: Undefined variable: var_uang in D:\EasyPHP-5.3.1\www\bukutamu\2.php on line 3
anybody can solve my problem



my script
1.php
<?php

$uang = "Rp 15.000";
echo "<a href=\"2.php?var_uang=$uang\">
uang ditampilkan di 2.php</a>";

?>

2.php
<?php

echo "$var_uang";

?>
Posted by: Amour
February 21, 2010 09:05AM
Into 2.php, $var_uang don't exists... you must use $_GET['var_uang'] because you use GET method ;)

Also, if you use a form and POST method, you will use $_POST vars.
Posted by: ioeasy
June 23, 2011 05:57PM
You need call the value with a request value

<?php

$uang = "Rp 15.000";
echo "<a href=\"".$_SERVER['PHP_SELF']."?var_uang=$uang\">
uang ditampilkan di 2.php</a>";

?>


<?php
$var_uang=$_REQUEST['var_uang'];
echo "$var_uang";

?>

;)