|
-
Aug 31st, 2008, 03:39 PM
#1
Thread Starter
Hyperactive Member
Fix this nasty looking php/javascript code
Hi,
I really need to help fixing this horrible piece of code which is all over the place. All it does is run a javascript function to check/uncheck my boxes on my form.
However, because the js quotes need to be single, and the echo quotes are double I've just made it into this crazy chunk of code!
Code:
//SHOWS THE CHECK ALL/UNCHECK ALL BOXES
echo '</table><input type="button" onclick="SetAllCheckBoxes(';
echo "'killform', 'killed[]', true);";
echo '" value="Select all" /><br /><br /><input type="button" onclick="SetAllCheckBoxes(';
echo "'killform', 'killed[]', false);";
echo '" value="Deselect all" /><br /><br /><input type="submit" name="kill" value="Kill" /></form>';
I agree, it looks terrible.
Ideally, it would be great if I could have it all in a link - such as a href=javascript... etc.
How can I clean this up?? Thanks for any help!!!
-
Aug 31st, 2008, 04:24 PM
#2
Re: Fix this nasty looking php/javascript code
I have mentioned many many times, that you should not use echo to output HTML. It is clear that my efforts have been in vain If you take my advice then the issue you will having will not arise.
-
Sep 1st, 2008, 02:44 AM
#3
Thread Starter
Hyperactive Member
Re: Fix this nasty looking php/javascript code
Ah, ok visualAd, I will take note now - what is the correct method please?
-
Sep 1st, 2008, 03:21 AM
#4
Re: Fix this nasty looking php/javascript code
Take away all the echo statements and you can use single or double quotes as you wish.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|