/    Sign up×
Community /Pin to ProfileBookmark

find php variable from url

hey guys… um well ive done this so far in my php:

[CODE]echo “<input type=checkbox onclick=”window.location = window.location+’&employees_show=inactive’;””; if($_GET[employees_show]!=”inactive”) { echo ” checked”; } echo “>”;[/CODE]

and what i need is to change it. to find if that variable EMPLOYEES_SHOW is to “inactive” or if it is set at all… anf if it is then after onclick change it to “active”…

hard to explain, but hope you understand…
the thing is that i need onclick to change url with the variable EMPLOYEES_SHOW to active/inactive

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@allanice001Oct 15.2009 — is this in a form that is being posted? or are you trying to change the output of the form depending if checkbox is checked or not?
Copy linkTweet thisAlerts:
@ShokartaauthorOct 15.2009 — um its not a form, its just single checkbox...

so once i click on it it should reload the page with the variable change
Copy linkTweet thisAlerts:
@allanice001Oct 15.2009 — Try this.....

ifit iswrong way around, just change window.location
[code=php]<?php

function get($name, $default = '', $get = true, $post = true)
{
return $post && isset($_POST[$name]) ? $_POST[$name] : ($get && isset($_GET[$name]) ? $_GET[$name] : $default);
}

$action = get('action');
echo
'<input type="checkbox" name="action" value="1"'. ($action ? ' onclick="window.location = window.location+'&employees_show=active'"; checked="checked"' : ' onclick="window.location = window.location+'&employees_show=inactive'";');[/code]
Copy linkTweet thisAlerts:
@ShokartaauthorOct 15.2009 — haha sure think it works this way... but think about that... if you just keep clicking on the checkbox then you will have a looong url with like:

http://localhost/evas/index.php?page=admin/done&id_work=2&employees_show=inactive&employees_show=active&employees_show=inactive&employees_show=active&employees_show=inactive&employees_show=active
×

Success!

Help @Shokarta spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...