By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,216 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,216 IT Pros & Developers. It's quick & easy.

passing value to php script

P: 10
I am trying to pass a value from one PHP script to another PHP script. Below is the code. I am not sure why this is not working.

Thank you in advance for your help.
Fred Bernstein

<?php
if ($view_tenure_flag == 1) {
print('<p align="center"><a href="TenureData.php?view_tenure_flag=<?php echo $view_tenure_flag; ?>">View Tenure Records</a> </p>');
}
else if ($view_tenure_flag == 0) {
print('<p align="center"><a href="TenureData.php?view_tenure_flag=<?php echo $view_tenure_flag; ?>">Enter Tenure Records</a> </p>');
}
?>
Mar 1 '07 #1
Share this Question
Share on Google+
4 Replies


Motoma
Expert 2.5K+
P: 3,235
Your problem is you are embedding <?php?> in PHP which is unnecessary.
[php]
<?php
if ($view_tenure_flag == 1)
{
print('<p align="center"><a href="TenureData.php?view_tenure_flag='.$view_tenu re_flag.'">View Tenure Records</a> </p>');
}
else if ($view_tenure_flag == 0)
{
print('<p align="center"><a href="TenureData.php?view_tenure_flag='.$view_tenu re_flag.'">Enter Tenure Records</a> </p>');
}
?>
[/php]
Mar 1 '07 #2

P: 48
I am trying to pass a value from one PHP script to another PHP script. Below is the code. I am not sure why this is not working.

Thank you in advance for your help.
Fred Bernstein

<?php
if ($view_tenure_flag == 1) {
print('<p align="center"><a href="TenureData.php?view_tenure_flag=<?php echo $view_tenure_flag; ?>">View Tenure Records</a> </p>');
}
else if ($view_tenure_flag == 0) {
print('<p align="center"><a href="TenureData.php?view_tenure_flag=<?php echo $view_tenure_flag; ?>">Enter Tenure Records</a> </p>');
}
?>
You've PHP tags inside PHP tags of each print around the variable $view_tenure_flag. Try removing those so it looks like

print('<p align="center"><a href="TenureData.php?view_tenure_flag='.$view_tenu re_flag.'">View Tenure Records</a> </p>');

Don't forget to view the source in the browser too to make sure you're getting either
<p align="center"><a href="TenureData.php?view_tenure_flag=1">View Tenure Records</a> </p>
or
<p align="center"><a href="TenureData.php?view_tenure_flag=0">Enter Tenure Records</a> </p>

Just to think about, is it possible that $view_tenure_flag could be a value than 1 or 0?
Mar 1 '07 #3

P: 10
Your problem is you are embedding <?php?> in PHP which is unnecessary.
[php]
<?php
if ($view_tenure_flag == 1)
{
print('<p align="center"><a href="TenureData.php?view_tenure_flag='.$view_tenu re_flag.'">View Tenure Records</a> </p>');
}
else if ($view_tenure_flag == 0)
{
print('<p align="center"><a href="TenureData.php?view_tenure_flag='.$view_tenu re_flag.'">Enter Tenure Records</a> </p>');
}
?>
[/php]
Your solution resolved the problem. Thank you very much for your help.
Mar 1 '07 #4

Motoma
Expert 2.5K+
P: 3,235
Your solution resolved the problem. Thank you very much for your help.
Glad to help. Come back anytime you have a question.
Mar 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.