Page 1 of 2
call PHP code upon click to <li>List1</li>
Posted: Fri Jul 27, 2007 1:06 am
by rozvinbm_jp
Code: Select all
<li>List
<ul>
<li>List1</li>
<li>List2</li>
<li>List3</li>
</ul>
</li>
How to call the php code from that html tags... when I click List1?
Posted: Fri Jul 27, 2007 3:09 am
by miro_igov
you can use the onclick javascript event and document.location to redirect the browser to page.php?clicked=list1 then use if() to see if list i is clicked.
Posted: Fri Jul 27, 2007 3:16 am
by rozvinbm_jp
miro_igov wrote:you can use the onclick javascript event and document.location to redirect the browser to page.php?clicked=list1 then use if() to see if list i is clicked.
I forgot to mention,, I dont want to use GET method on this case... maybe via POST or SESSION but I dont know how to implement.
Posted: Fri Jul 27, 2007 3:44 am
by yisheng
Put a form and hidden field.
onclick will change the hidden field value and submit the form.
Not good coding though...
Posted: Fri Jul 27, 2007 3:57 am
by miro_igov
Why not good coding?
Posted: Fri Jul 27, 2007 4:06 am
by yisheng
Emm... from my point of view:
*using javascript unnecessary ( you could use <a href="somepage.php?list=1">list 1</a> )
*refering to above, you would need styling to show user that the list can be click without hyperlinking else it's not user friendly
*putting a form in a page that can do without it
*refreshing need affirmation in page ( as you use post, refreshing will create pop-up )
Just my views. maybe wrong.

Posted: Fri Jul 27, 2007 4:13 am
by miro_igov
Your arguments are unsubstantiated when you develop rich user interface.
*using javascript unnecessary ( you could use <a href="somepage.php?list=1">list 1</a> ) -> the author of this topic said that he is not allowed to use GET
*refering to above, you would need styling to show user that the list can be click without hyperlinking else it's not user friendly -> who said it is not done?
*putting a form in a page that can do without it -> why not and how else?
*refreshing need affirmation in page ( as you use post, refreshing will create pop-up ) -> are you sure? after processing the POST he can just use header('Location: ....') to transfer the user back to the original page, which is a must when you develop pages where user can edit his account, etc.
Posted: Fri Jul 27, 2007 4:14 am
by onion2k
miro_igov wrote:Why not good coding?
Because it won't work for users who have Javascript turned off. Considering how popular Firefox's NoScript plugin is getting you really need to consider that.
miro_igov wrote:the author of this topic said that he is not allowed to use GET
Actually he said he doesn't want to use GET. He should want to, it's the right tool for the job.
Posted: Fri Jul 27, 2007 4:19 am
by miro_igov
For those who disabled javascript the page will say "Please enable your javascript or disappear from here"

Posted: Fri Jul 27, 2007 4:22 am
by yisheng
Replying to your replies.
It's not about why and how. It's about views and what's your application is for.
I do see that you don't want to use GET but i don't know the good reason behind it.
I can't think of anyway beside a extra form if you wanna use post for now. Why not is because i don't like.
I do not know your direction of a page after posting. Why do you not use GET if after processing would be another page ( as u stated, header("Location: .. ") ) which won't show the query string?
Edit: Wrong, my bad. Should not use you/your. I didn't notice who post.
Posted: Fri Jul 27, 2007 4:32 am
by onion2k
miro_igov wrote:For those who disabled javascript the page will say "Please enable your javascript or disappear from here"

I guess you don't write commercial sites that people spend money on. Telling your potential customers to disappear isn't going to make you rich.
Javascript, AJAX, Flash, Java,
everything that extends a site should degrade down to a version that still works if the user's browser only supports basic HTML. Use clientside scripting to embellish and extend the user's experience - you should not replace the experience with something that may not work.
Posted: Fri Jul 27, 2007 6:47 am
by miro_igov
People who want to spend money on the site probably don't try to disable javascript. You cannot do cool interface without javascript (see Yahoo! web mail for example).
Posted: Fri Jul 27, 2007 8:11 am
by onion2k
miro_igov wrote:People who want to spend money on the site probably don't try to disable javascript.
That's completely wrong. Most people who disable Javascript are business users or geeks who understand security - two groups who have money to buy stuff. The fact is that if your site requires javascript to function then you
will be losing conversions. It's inescapable.
miro_igov wrote:You cannot do cool interface without javascript (see Yahoo! web mail for example).
You can make an interface that works without Javascript, but detects Javascript and adds on cool stuff if it's available. That's the
only way to write a good, usable, accessible website.
You should also remember that in the USA and the UK there are laws governing the accessibility (Section 508 in the USA, Disability Discrimination Act in the UK). If your business offers a service then it has to be available to everyone equally. In the case of online services that means that if your website is not accessible to someone using a text-to-speech browser, or a user defined stylesheet, or
one that disabled javascript, then they can sue you for lots and lots of money because you have discriminated against them by making a service that's precludes access by disabled people.
You can argue it as much as you like but you are wrong if you think a website that doesn't work without Javascript isn't a problem. It is.
Posted: Fri Jul 27, 2007 8:27 am
by miro_igov
onion2k are you trying to say that if a user uses Lynx and can't see images he will sue the site for discrimination because very useful content is kept in the images and he can't access it?
People who deliberately disabled javascript are supposed to not get some service which uses javascript, if they really want it they must enable javascript and agree with the site policy in which is mentioned that non-javascript browsers are not supported on this site.
By your logic why then javascript exists? With such a success people can disable cookies and sue you because they can't login to your site which uses sessions and they can't access certain service.
And for those with monochrome displays - they will complain why you used colors in your charts instead of using black,gray, dashed, dotted lines - discrimination - they can't get the service.
And why AJAX is not discontinued, and why there is WEB 2.0 ? These also must be stopped ?
Posted: Fri Jul 27, 2007 8:58 am
by superdezign
miro_igov wrote:People who deliberately disabled javascript are supposed to not get some service which uses javascript, if they really want it they must enable javascript and agree with the site policy in which is mentioned that non-javascript browsers are not supported on this site.
Actually, the issue isn't whether or not they'll turn it on, but whether or not they even feel that some website that said "Without JavaScript, you cannot use our services," is worth their time. Likely, they'll just go to a competitor. When you own a store, you don't want to ban all people choose to wear headphones into a store from coming in because then they'd miss out on all of the good music you're playing over the intercom system.
Accessibility is accessibility.