| | |
Adding links inside php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 12
Reputation:
Solved Threads: 0
Hello, I'm having a strange problem. I'm trying to make a link to a page called stats.php for a series of first names that I have stored in a database. However, when I use the code below the hyperlink ends up being a link to the current page I'm on instead of to stats.php. Any help would be greatly appreciated.
..the following is in a while loop:
Step 2 is that I want the page stats.php to display other stored info about the person, so I need to pass the person's name to to the next page when the link is clicked, and then be able to access the db with it, so if you have any helpful hints on how to do that, I'd appreciate that as well. Thanks!
..the following is in a while loop:
php Syntax (Toggle Plain Text)
$fname=$row['fname']; echo "<td>"; echo "<a href 'stats.php'>$fname</a>"; echo "<td>";
Step 2 is that I want the page stats.php to display other stored info about the person, so I need to pass the person's name to to the next page when the link is clicked, and then be able to access the db with it, so if you have any helpful hints on how to do that, I'd appreciate that as well. Thanks!
Take a look at this line:
You are missing the = on href.
PHP Syntax (Toggle Plain Text)
echo "<a href 'stats.php'>$fname</a>";
You are missing the = on href.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
•
•
Join Date: Aug 2009
Posts: 25
Reputation:
Solved Threads: 2
•
•
•
•
Take a look at this line:
PHP Syntax (Toggle Plain Text)
echo "<a href 'stats.php'>$fname</a>";
You are missing the = on href.
PHP Syntax (Toggle Plain Text)
echo "<a href='stats.php'>{$fname}</a>";
•
•
Join Date: Sep 2009
Posts: 12
Reputation:
Solved Threads: 0
Ah! Of course its something so basic that I forgot. Ah well, so goes it when you're a newbie programmer. Thanks a lot. Also, the suggestion for putting curly brackets around the variable will let me omit the first line where I had to convert the variable: $fname=$row['fname']; - and might actually solve a bigger chronic problem I've been having... so thanks for that too.
One last thing, I'm using the following line to send fname when the user clicks on it (using info I found on this site), but I can't figure out how to use it on the next page. I've been scanning the web for info so if I find the answer I'll report back...
One last thing, I'm using the following line to send fname when the user clicks on it (using info I found on this site), but I can't figure out how to use it on the next page. I've been scanning the web for info so if I find the answer I'll report back...
PHP Syntax (Toggle Plain Text)
echo "<a href='stats.php?param={$row['fname']}'>{$row['fname']}</a>";
To retrieve the variable param from the url simply use $_GET['param'] to get its value.
Try not to bump 10 year old threads as it can be really annoying.
http://syntax.cwarn23.net/
My favourite PC. - MacGyver Fan
http://syntax.cwarn23.net/
Smilies: ^_* +_+ v_v -_- *~*` My favourite PC. - MacGyver Fan
![]() |
Similar Threads
- Connecting to MySQL with PHP (MySQL)
- Adding CSS content into an PHP include(); (PHP)
- Running perl script inside php file (PHP)
- PR6 Quality header links for sale on PHP authority site (Ad Space for Sale)
- PR6 Quality header links for sale on PHP authority site (Ad Space for Sale)
- javascript inside PHP (PHP)
- HTML codes in PHP (PHP)
- need help with a php issue (PHP)
Other Threads in the PHP Forum
- Previous Thread: Upload a Thumbnail of selected file
- Next Thread: XAMPP - Apache service not working!
| Thread Tools | Search this Thread |
Tag cloud for href, link, php
access ads ajax api archive array asp autosuggest beginner broken class close cms codes cookies curl data database date developers display downloader email exchange execution file files flash form forms forum function gaming google href html if...loop image include integration java javascript jquery lamp limit link linux login mail menu movies multiple multipletables mysql object oop oracle password paypal php post programming projectmanager query root rss schools script search searchmonkey security seo server session sessions simple sms smtp soap sorting spam sql tables text trouble tutorial unicode upload url validation variable vbulletin video web webdesign xml xslt ydn youtube zend







