I have 3 questions and would be thankful in any answers I can get. Lets start with the most important one, which is in the subject.
1. How do I echo a <a href> tag to link to another php function?
For Example:
<?php
echo "<a href=\"<?php a_function() ?>\">LINK</a>";
?>
I keep getting an error. I also tried without the <?php ?> tags but it takes me to the wrong link. I then also tried putting \"<\?php a_function() \?>\" as the target but that also took me to a nonexisting page.
2. Is there any way to detect OnClick javascript with PHP?
3. How do I transfer variable data from javascript to PHP?
How to echo <a href> to link to a php function???????
Moderator: General Moderators
- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
what you need is to break the string in the middle to insert function call
that's it!
Code: Select all
echo "<a href='".a_function()."'>LINK</a>";Thanks guys you have really helped a lot. For the <b>harrisonad</b> solution, it ran the function after echoing it. I was trying to put the function in a link so when you click on it, it would run it then not while it was in the echo.
To use JavaScript and PHP I had the PHP call the javascript function, which then created cookies. Then I use PHP to access those cookies.
Thanks again; you guys rock!!!!
To use JavaScript and PHP I had the PHP call the javascript function, which then created cookies. Then I use PHP to access those cookies.
Thanks again; you guys rock!!!!