Created variable does not stay alive

Dear guru’s :smiley:

I have been google-ing for the problem but other solutions or tips I cant apply to my script, or dont know how to.

The folowing is my target:

I have 2 databases, 1 with prices, 1 with names of different providers of the product.
They both have a field to link those together, so far so good.

I’ve put the names into a dropdown menu and am able to choose one and it will get displayed on the page neatly formatted into a table.

Just one thing that really bugs me is that I can get the Id code of the provider from the seccond DB echo’d onto the page, but I cant get the Name of the provider from the first DB echo’d.

To clarify my point, just click on the “geef prijzen” button on the following page:
http://flexdatawebsite.nl/index.php/tarieven

The script is the following:

[code]<?php

//Variables
$username="";
$password="
";
$database=“prijzen”;
$tabel2=“Ziekenfonds”;
$value= $_POST[“value”];

//connecting to database
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);

$query2=“SELECT * FROM $tabel2”;

$result2=mysql_query($query2);

$num2=mysql_numrows($result2);

mysql_close();
?>

' method='post' name='value' > <?php $o=0; while ($o < $num2) { $v1=mysql_result($result2,$o,"LISZcode"); $v2=mysql_result($result2,$o,"Ziekenfonds"); $zorg=mysql_result($result2,$o,"Ziekenfonds"); ?> <?php echo $v2; ?> <?php $o++; } ?> <?php //Variables $username="**"; $password="**"; $database="prijzen"; $tabel="Tarief"; $value= $_POST["value"]; $defaultdisplay="9999"; //connecting to database mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM $tabel WHERE LiszCode='$value'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); ?>

Tarieven Zorgverzekeraarcode:
<?php echo $value; ?> PROBLEM ECHO<?php echo $zorg; ?>

<?php $i=0; while ($i < $num) { $f2=mysql_result($result,$i,"LiszCode"); $f3=mysql_result($result,$i,"Omschrijving"); $f4=mysql_result($result,$i,"Bedrag"); $f5=mysql_result($result,$i,"JaarGeldig"); ?> <?php $i++; } ?>
Prestatiecode Omschrijving Kostprijs Geldig t/m
<?php echo $f2; ?> <?php echo $f3; ?> <?php echo $f4; ?> <?php echo $f5; ?>
[/code]
Sponsor our Newsletter | Privacy Policy | Terms of Service