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

href passing values to php script

P: 10
I am trying to create a hyperlink that also passes a value to the destination php
page? I think the syntax is correct. The value contained in the $id_num variable does not appear in the called PHP script. Below is a sample of the code.

Thanks for your help.
Fred

Code from calling PHP script
[php]
<table width="700" border="0" align="center">
<tr>
<td width="30%" nowrap><A class=blue href="http://cc010.admin.esu.edu:12345/test/idnumtest.php?id_num=$idnum&amp;"><?php echo "<font style='font-family: ariel; font-size: 16px;'>" . $fn . ' ' . $mn . ' ' . $ln . "</font>" ?></a></td>
</tr>
</table>[/php]

Code from php script
[php]
<?php

// GET $id_num from Enter_Faculty_Info script
$id_num = $_GET['id_num'];
print "\n id_num = $idnum\n\n";
?>[/php]
Feb 16 '07 #1
Share this Question
Share on Google+
3 Replies


ronverdonk
Expert 2.5K+
P: 4,258
Since the following statement is not generated by PHP but just plain HTML, you must enclose any PHP variable that you want to pass on within the php tags, just like you do with the echo of the style. So you must <?php echo $idnum; ?> it.

[php]<td width="30%" nowrap><A class=blue href="http://cc010.admin.esu.edu:12345/test/idnumtest.php?id_num=$idnum&amp;"><?php echo "<font style='font-family: ariel; font-size: 16px;'>" . $fn . ' ' . $mn . ' ' . $ln . "</font>" ?></a></td>[/php]

Ronald :cool:
Feb 16 '07 #2

P: 10
Since the following statement is not generated by PHP but just plain HTML, you must enclose any PHP variable that you want to pass on within the php tags, just like you do with the echo of the style. So you must <?php echo $idnum; ?> it.

[php]<td width="30%" nowrap><A class=blue href="http://cc010.admin.esu.edu:12345/test/idnumtest.php?id_num=$idnum&amp;"><?php echo "<font style='font-family: ariel; font-size: 16px;'>" . $fn . ' ' . $mn . ' ' . $ln . "</font>" ?></a></td>[/php]

Ronald :cool:
Thank you for your reply. I did as you suggested and modified how I am referencing $idnum:

<td width="30%" nowrap><A class=blue href="http://cc010.admin.esu.edu:12345/test/idnumtest.php?id_num=<?php echo $idnum; ?>"><?php echo "<font style='font-family: ariel; font-size: 16px;'>" . $fn . ' ' . $mn . ' ' . $ln . "</font>" ?></a></td>

The problem is now resolved. Thank you very much for your help.

Fred
Feb 16 '07 #3

ronverdonk
Expert 2.5K+
P: 4,258
You are welcome any time.

Ronald :cool:
Feb 16 '07 #4

Post your reply

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