jr8rdt Posted April 8, 2008 Share Posted April 8, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/ Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 <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 Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512151 Share on other sites More sharing options...
jr8rdt Posted April 8, 2008 Author Share Posted April 8, 2008 still not working. I have tried in a.php: 1) echo $id_chart 2) $chart_id = $_REQUEST[id_chart]; echo $chart_id; both dont work. Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512178 Share on other sites More sharing options...
wildteen88 Posted April 8, 2008 Share Posted April 8, 2008 You should use $_GET['id_chart'] You'd use this var in a.php b.php c.php and d.php You wont be able to retrieve data you pass to a.php from another page. Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512188 Share on other sites More sharing options...
jr8rdt Posted April 8, 2008 Author Share Posted April 8, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512206 Share on other sites More sharing options...
craygo Posted April 8, 2008 Share Posted April 8, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512234 Share on other sites More sharing options...
laffin Posted April 8, 2008 Share Posted April 8, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512258 Share on other sites More sharing options...
jr8rdt Posted April 8, 2008 Author Share Posted April 8, 2008 hah....find the answer. You can't pass the the value twice. so I use only id1 and it works! Quote Link to comment https://forums.phpfreaks.com/topic/100167-how-to-pass-a-value-to-multiple-php-programs/#findComment-512312 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.