Replacing a string on click of a button


Posted on 16th Feb 2014 07:03 pm by admin

Hi! Is there a way to replace a string on a click of a text link?

This is what I've come up with. It doesn't work at all ^^;;

Did you know?Explore Trending and Topic pages for more stories like this.
Code: <head>
<?php
$string = Red;
function changeBlue() {
$string=blue;
}
function changeGreen() {
$string=green;
}
?>
</head>

<body>
<p>The colour is <?php echo $string ?></p>
<br />
<a onclick='changeBlue()'>Blue</a>
<a onclick='changeGreen()'>Green</a>
</body>

I'm starting to learn PHP by myself, and I was hoping someone could help me wrap my head around this problem.
No comments posted yet

Your Answer:

Login to answer
175 Like 41 Dislike
Previous forums Next forums
Other forums

Passing an array of values From VB6.0 to Oracle PL/SQL Function
Basically we are using VB6.0.

When we try to pass an array from VB6.0 to an Oracle PL/SQL

How can i use [] tags instead of <> tags for profiles??
On my site im making ive made it so u can register, login and u have a profile which u can update..<

mail with attachment problems
Hi. I have the following code:
Code: else if(file_exists("site".$timp.".zip")

date("now") prints out wrong date ?
Hi Guys
Anyone know why and how I can fix it ?

TimeZoneOffset
Hello,

Please i need your help. I have a system that users can use to punch in and out. This

Logic question
im wondering what's the best method to do the above list:

it is for alliance @ MMORPG game

PHP error. Need help urgently
Hi,

I am programming a php site and have a problem that i just cant find out how to fix. When

Image upload - determine folder
I have an upload script that may be accessed from different directories. Problem is, the script is m

with clause
hi all, i have a big query that usually access the same table more than once. for example, i have s

type check while uploading
Hi Everyone,

How can I check the exact type of a file while uploading on my site?

Here

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash