Jump to content

How to pass a value to multiple PHP programs?


jr8rdt

Recommended Posts

How to pass a value to multiple phps?

 

I want to pass $id_chart to a.php, b.php, c.php, d.php all at once , automatically, without user interaction.

a.php, b.php, c.php, d.php are graphics maker which take $id_chart to create graphs.

 

<?php
$id_chart = $_REQUEST[id1];
?>

<html>
<img src="a.php"  border=0 align=center width =640 height=480>
<p>
<img src="b.php"  border=0 align=center width =640 height=480>
<p>
<img src="c.php"  border=0 align=center width =640 height=480>
<p>
<img src="d.php"  border=0 align=center width =640 height=480>
</html>

 

<img src="a.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>

<img src="b.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>

<img src="c.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>

<img src="d.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>

 

Ray

still not working . the problem is when I run below program the url says

...chart.php?id1=17

 

why it is id1 and not id_chart

id1 inside chart.php is 17 but when it is passed to a.php it is empty.

it is understandable.

so the question again is why the url is passing id1 and not id_chart?? id_chart  has the correct value

 

<?php
$id_chart = $_REQUEST[id1];
echo $id_chart;
?>

<html>



<img src="a.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>
<p>
<img src="b.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>
<p>
<img src="c.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>
<p>
<img src="d?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>

</html>

Try this

<?php
$id_chart = $_REQUEST['id1'];  // should have quotes around anything that is not an integer
echo $id_chart;
?>

<html>



<img src="a.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>
<p>
<img src="b.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>
<p>
<img src="c.php?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>
<p>
<img src="d?id_chart=<?php echo $id_chart; ?>"  border=0 align=center width =640 height=480>

</html>

 

Also on your a,b,c,d pages. Is it looking for the parameter id_chart or id1??

 

Ray

depends if u want user to see the output of the scripts or not.

 

if they are generated images, u can use the <IMG tag, so user can see the generated output.

 

if u dun want user to see the scripts output, u can use fopen('url'), however keep in mind of the timeout.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.