/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Value not setting correctly

I am trying to determine if an input is set to give one answer or if it is not set another answer. Here is my code:

[code=php]
if(!isset($_POST[‘url’]))
$website = 0;
else
$website = 1;[/code]

I have also tried these few way:

[code=php]
$url = $_POST[‘url’];
if(!isset($url))
$website = 0;
else
$website = 1;[/code]

[code=php]if(isset($_POST[‘url’]))
$website = 1;
else
$website = 0;[/code]

For some reason it always sets 1 but the output is this:

[code=html]<input name=’url’ value=” />[/code]

Any suggestions?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@ChipzzzApr 07.2010 — How about this:
<i>
</i>$url = $_POST['url'];
if(isset($url) &amp;&amp; ($url!=''))
$website = 1;
else
$website = 0;


Good luck,

Chipzzz
Copy linkTweet thisAlerts:
@monarch_684authorApr 07.2010 — Thanks that worked!!!
×

Success!

Help @monarch_684 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...