View Full Version : Using text link to do something
06-25-2010, 01:49 AM
I'm just learning PHP and after using actionscript a lot, I noticed they were very similar. The problem I'm having, though, is that with PHP you can't simply turn anything into a button and give it an onRelease code. What I want to do is have a text link that changes a variable when it is clicked.
<?php $variable = 7;
echo "<a href=\"thispage.php\" $variable = 6>Change Variable</a>"; ?>
06-25-2010, 02:06 AM
Wanna tell us a bit more of the goal?
06-25-2010, 02:26 AM
In actionscript you can do something like:
myVariable = 7;
myVariable = 8;
I want to basically do the same thing, except with a text link instead of a submit button.
<?php $myVariable = $_POST['varChange'];
echo $myVariable."<form action=\"this.php\" method=\"post\">
<input type=\"text\" name=\"varChange\" />
<input type=\"submit\" name=\"Submit\">
Kind of a sloppy example, but I'm sure I could work with it to make it more like the actionscript example, but anyway, the submit button is the only way I know of to have a button do a PHP task. Instead of a button, I'd like to be able to use a text link.
06-25-2010, 03:05 AM
Heh, so I wrote a big long piece of code when I reread your post/request.
06-25-2010, 03:24 AM
06-25-2010, 03:32 AM
As a suggestion (from someone who only seriously picked this up a few short years ago), focus on HTML and PHP first. Those are the backbones of webdesign, and I (and a number of other developers) believe that JS should augment a website, it should help a website out, but as users can (and often do) disable JS, your website should be able to work without it, unless its fulfilling a core element (google maps for example).
06-25-2010, 03:52 AM