Jump to content


Photo

I need help passing information


  • Please log in to reply
3 replies to this topic

#1 ipuck

ipuck
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 August 2006 - 09:48 PM

Hello:
I have a file that receives information (variables X,Y,Z) from a link, searches a database and display results. No problem with that.

Now I need to use that same information (X,Y,Z) and send it to another page. (A plain page for printing the data)

$X = $_POST['value1'];
$Y = $_POST['value2'];
$Z = $_POST['value3'];

echo ('Data information for variables');
echo ( $X $Y $Z);

echo ('<a href="somefile.php?value1=$X&value2=$Y&value3=$Z">Print View</a>');

$strSQL = "SELECT table.* FROM table WHERE field1='X' AND field2='Y' AND field3='Z";

Rest of the file
'
if

else
while ($row =
'




My problem is that is not no passing the information, in the link only shows:

http://www.mysite.com/somefile.php?value1=$X&value2=$Y&value3=$Z



and not the value of the variables.

What am I doing wrong?

I use the same system to get the information in the first place.

Thanks for any help



#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 27 August 2006 - 09:58 PM

You are using single quotes in your echo statement. PHP will treat your variables as-is and will not parse the the variables. Use double quotes or use the concatenation operator:
Double quotes:
echo "<a href=\"somefile.php?value1={$X}&value2={$Y}&value3={$Z}\">Print View</a>";


Concatenation operator:
echo '<a href="somefile.php?value1=' . $X . '&value2=' . $Y . '&value3=' . $Z . '">Print View</a>';


#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 August 2006 - 10:07 PM

<?php

$x = $_POST['x']; 
$y = $_POST['y']; 
$z = $_POST['z']; 

echo "<a href='somefile.php?x=$x&y=$y&z=$z&cmd=print'>Print View[/url]"; 

?>



somfile.php
<?php

$x=$_GET['x'];
$y=$_GET['y'];
$z=$GET['z'];

if($_GET['cmd']=="print"){

echo " $x <br> $y <br> $z ";

}

?>


Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 ipuck

ipuck
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 28 August 2006 - 12:58 AM

Thank you guys for your help!!

I add a \  , like wildteen88  suggested and it worked.


echo ("<a href= \" somefile.php?value1=$X&value2=$Y&value3=$Z \" >Print View</a>");


Thanks again!!










0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users