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 ^^;;

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

Revoking alter any table from a schema
Hi All,

i am working in Oracle 10g.
my requirement is to revoke all kind of DDL oper

PHP/PKI
I am trying to set up a web application that uses pki. does anyone have a good tutorial to set this

Can I use a loop
Hi buddies!

Once again with my doubts here.

Right now I am using this sql stat

Is there a quick way to do this?
Hi all,

I need to create a mysql table from php that goes a little something like this

extract a file from zip file
hi,
i know how to unzip a zip file in php, but is there a way to just extract a certain file only

Echo-ing MySQL content and Keep Formatting?
I have data in my MySQL such as:

QuoteBlah blah

Blah blah

etc
but when i ech

Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag

Coding Critique
I was hoping someone could take a second and look down my code and see if they see any problems with

Error: SQL Syntax; Line 1
Code:

<?php require "global_settings.php"; ?>
<title&g

Session variable help
I'm having a very troubling issue. Maybe I'm just looking over something but I have looked at the co

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