Re: checkbox own set and reload page [message #170547 is a reply to message #170546] |
Sun, 07 November 2010 16:15 |
sheldonlg
Messages: 166 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 11/7/2010 7:53 AM, anver wrote:
>> As I understand it, here is what he means -- and anver correct me if I
>> am wrong.
>>
>> On his form he has a checkbox.
>> When the user checks this checkbox, he wants something done, namely to
>> run function B and do things.
>
> ok run a code B1 inner function B
>
>> When the user unchecks this checkbox, he doesn't want to do things.
>
> ok not more run code B1 inner function B (or run other code B2)
>
>
>
>> So, the simplest way is to have a Javascript function which does the
>> following:
>>
>> function newFunction() {
>> -- test on whether checked or not.
>> -- if not checked then return
>> -- if checked then do what he wants done in function B or call
>> function B
>> }
>
> ok is necessary javascript;
> steps are this
> when page is loaded check is off (default) and run function B and its code
> B;
> if a user click on the check, is necessary to reload the page for run
> function B and code B2;
The function above is a javascript function. No need to reload the
page, however you can do that if you want to. Otherwise, innerHTML does
the job.
>
>
>
>
>
>> Now I am not sure what he wants as far as written to the PC,
>
>
> simple:
> if php or js achieved the value of check inner a db or server, oneother
> user that use the same form will have the set of the first user; this isn't
> correct;
I think you need to find someone who speaks your language and better
English and have them compose the post for you. I simply cannot
understand what you are trying to say or do. Sorry.
However, I will say this much:
php only gets the value one of three ways:
1 - the form is submitted and it gets the value of the checkbox (checked
or unchecked) from $_POST.
2 - a link on the page that passes values in the URL. You would have to
compose the value at the time of click. php gets it via $_GET.
3 - an AJAX call from javascript. It gets the values via $_GET from the
URL that the javascript sends.
In all cases php has NO connection to the user's PC because it ALL
happens on the server.
Why would you want to set anything (other than cookie) on the user's PC?
If someone else comes along is that person going to be using the same
PC? Normally you set things on the server in either a file or a
database table.
>
>
> thanks
--
Shelly
|
|
|