Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14056 > unrolled thread

if condition in php syntax required

Started bymaxinetindia@gmail.com
First post2014-07-03 18:31 -0700
Last post2014-07-05 03:21 +0200
Articles 8 — 5 participants

Back to article view | Back to comp.lang.php


Contents

  if condition in php syntax required maxinetindia@gmail.com - 2014-07-03 18:31 -0700
    Re: if condition in php syntax required Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-03 21:45 -0400
      Re: if condition in php syntax required maxinetindia@gmail.com - 2014-07-03 18:54 -0700
        Re: if condition in php syntax required Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-03 22:08 -0400
        Re: if condition in php syntax required Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-07-04 17:02 +0000
    Re: if condition in php syntax required Denis McMahon <denismfmcmahon@gmail.com> - 2014-07-04 02:34 +0000
      Re: if condition in php syntax required maxinetindia@gmail.com - 2014-07-03 19:50 -0700
    Re: if condition in php syntax required Arno Welzel <usenet@arnowelzel.de> - 2014-07-05 03:21 +0200

#14056 — if condition in php syntax required

Frommaxinetindia@gmail.com
Date2014-07-03 18:31 -0700
Subjectif condition in php syntax required
Message-ID<54cfee18-c312-47b0-85cc-46f0e34c50d4@googlegroups.com>
I am a newbie with no knowledge of php. i have a register.php file with piece of code in ..... tag that asks for username password and other details. The country is selected automatically and the script is included in the register.php file. I dont know how to find which is the correct variable and how to write if statement. The line where the variable can be found is echo ''.$ctr['country'].'';

I want to check the country in the if statement and if the country belongs to "India", it should show the register.php file contents (between the tags, else just show a message that "We accept registration only from India"

Can someone give me the syntax how to write? I searched for it but was very confused in php tags and semicolons

example

if country = india
<div>
.
.
.
</div>
else
custom message
endif

[toc] | [next] | [standalone]


#14057

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-07-03 21:45 -0400
Message-ID<lp5108$f7g$1@dont-email.me>
In reply to#14056
On 7/3/2014 9:31 PM, maxinetindia@gmail.com wrote:
> I am a newbie with no knowledge of php. i have a register.php file with piece of code in ..... tag that asks for username password and other details. The country is selected automatically and the script is included in the register.php file. I dont know how to find which is the correct variable and how to write if statement. The line where the variable can be found is echo ''.$ctr['country'].'';
> 
> I want to check the country in the if statement and if the country belongs to "India", it should show the register.php file contents (between the tags, else just show a message that "We accept registration only from India"
> 
> Can someone give me the syntax how to write? I searched for it but was very confused in php tags and semicolons
> 
> example
> 
> if country = india
> <div>
> .
> .
> .
> </div>
> else
> custom message
> endif
> 

The first thing is - if you're going to be dealing with PHP scripts, you
NEED to learn PHP or hire a consultant who does.  Don't expect to be
able to just copy scripts from the internet and expect them to work.
And don't expect others to help you all of the time just because you
don't know what you're doing.  All of us here are volunteers; we help
those who try on their own.  But we aren't unpaid consultants.

As to your question - why even bother to ask?  Just tell people you only
accept registrations from India, and remove the country selection code
all together.  Don't give someone a choice if there is only one correct
answer.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#14058

Frommaxinetindia@gmail.com
Date2014-07-03 18:54 -0700
Message-ID<59b9e94d-081f-4374-b86f-93879f61491a@googlegroups.com>
In reply to#14057
On Friday, July 4, 2014 7:15:42 AM UTC+5:30, Jerry Stuckle wrote:
> On 7/3/2014 9:31 PM, maxi@gmail.com wrote:
> 
> > I am a newbie with no knowledge of php. i have a register.php file with piece of code in ..... tag that asks for username password and other details. The country is selected automatically and the script is included in the register.php file. I dont know how to find which is the correct variable and how to write if statement. The line where the variable can be found is echo ''.$ctr['country'].'';
> 
> > 
> 
> > I want to check the country in the if statement and if the country belongs to "India", it should show the register.php file contents (between the tags, else just show a message that "We accept registration only from India"
> 
> > 
> 
> > Can someone give me the syntax how to write? I searched for it but was very confused in php tags and semicolons
> 
> > 
> 
> > example
> 
> > 
> 
> > if country = india
> 
> > <div>
> 
> > .
> 
> > .
> 
> > .
> 
> > </div>
> 
> > else
> 
> > custom message
> 
> > endif
> 
> > 
> 
> 
> 
> The first thing is - if you're going to be dealing with PHP scripts, you
> 
> NEED to learn PHP or hire a consultant who does.  Don't expect to be
> 
> able to just copy scripts from the internet and expect them to work.
> 
> And don't expect others to help you all of the time just because you
> 
> don't know what you're doing.  All of us here are volunteers; we help
> 
> those who try on their own.  But we aren't unpaid consultants.
> 
> 
> 
> As to your question - why even bother to ask?  Just tell people you only
> 
> accept registrations from India, and remove the country selection code
> 
> all together.  Don't give someone a choice if there is only one correct
> 
> answer.
> 
> 
> 
> -- 
> 
> ==================
> 
> Remove the "x" from my email address
> 
> Jerry Stuckle
> 
> jstuckle@attglobal.net
> 
> ==================

Sorry to bother, i tried a lot however struggled to get the correct syntax. the country dropdown is working fine and it disabled coz user is not given a choice to select the country, it is picked up automatically. I wanted the custom message for a reason that I do not want users from other countries to register. even if i tell abroad country user not to register, I cannot stop them. I will get an entry in my database that i will need to delete.

I thought I would get some help here and hence I posted. once again... sorry to bother

[toc] | [prev] | [next] | [standalone]


#14059

FromJerry Stuckle <jstucklex@attglobal.net>
Date2014-07-03 22:08 -0400
Message-ID<lp52bo$lnl$1@dont-email.me>
In reply to#14058
On 7/3/2014 9:54 PM, maxinetindia@gmail.com wrote:
> On Friday, July 4, 2014 7:15:42 AM UTC+5:30, Jerry Stuckle wrote:
>> On 7/3/2014 9:31 PM, maxi@gmail.com wrote:
>>
>>> I am a newbie with no knowledge of php. i have a register.php file with piece of code in ..... tag that asks for username password and other details. The country is selected automatically and the script is included in the register.php file. I dont know how to find which is the correct variable and how to write if statement. The line where the variable can be found is echo ''.$ctr['country'].'';
>>
>>>
>>
>>> I want to check the country in the if statement and if the country belongs to "India", it should show the register.php file contents (between the tags, else just show a message that "We accept registration only from India"
>>
>>>
>>
>>> Can someone give me the syntax how to write? I searched for it but was very confused in php tags and semicolons
>>
>>>
>>
>>> example
>>
>>>
>>
>>> if country = india
>>
>>> <div>
>>
>>> .
>>
>>> .
>>
>>> .
>>
>>> </div>
>>
>>> else
>>
>>> custom message
>>
>>> endif
>>
>>>
>>
>>
>>
>> The first thing is - if you're going to be dealing with PHP scripts, you
>>
>> NEED to learn PHP or hire a consultant who does.  Don't expect to be
>>
>> able to just copy scripts from the internet and expect them to work.
>>
>> And don't expect others to help you all of the time just because you
>>
>> don't know what you're doing.  All of us here are volunteers; we help
>>
>> those who try on their own.  But we aren't unpaid consultants.
>>
>>
>>
>> As to your question - why even bother to ask?  Just tell people you only
>>
>> accept registrations from India, and remove the country selection code
>>
>> all together.  Don't give someone a choice if there is only one correct
>>
>> answer.
>>
>>
>>
>> -- 
>>
>> ==================
>>
>> Remove the "x" from my email address
>>
>> Jerry Stuckle
>>
>> jstuckle@attglobal.net
>>
>> ==================
> 
> Sorry to bother, i tried a lot however struggled to get the correct syntax. the country dropdown is working fine and it disabled coz user is not given a choice to select the country, it is picked up automatically. I wanted the custom message for a reason that I do not want users from other countries to register. even if i tell abroad country user not to register, I cannot stop them. I will get an entry in my database that i will need to delete.
> 
> I thought I would get some help here and hence I posted. once again... sorry to bother
> 

You can get help here.  But if you're going to be using scripts (of any
kind), you need to learn the language that script is written in.  You
will find this pretty much consistent across the internet.  Some people
will help you for a bit.  But if you don't try on your own, they'll
quickly stop helping.  It's just a word to the wise.

As to your problem: If you've disabled the dropdown, then the user has
no choice and they won't be able to select a country.  So there is
nothing to test for.

Also, you can never stop a person from registering; I could simply say
I'm from India, even though I'm in the United States.  And if you don't
give me an option for the country, that's what I'll do.  It will look
like I'm in India - but I'm not.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#14062

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2014-07-04 17:02 +0000
Message-ID<XnsA36084A642019dougmilmaccom@78.46.70.116>
In reply to#14058
maxinetindia@gmail.com wrote in
news:59b9e94d-081f-4374-b86f-93879f61491a@googlegroups.com: 

> Sorry to bother, i tried a lot however struggled to get the
> correct syntax. the country dropdown is working fine and it
> disabled coz user is not given a choice to select the country,
> it is picked up automatically. I wanted the custom message for a
> reason that I do not want users from other countries to
> register. even if i tell abroad country user not to register, I
> cannot stop them. I will get an entry in my database that i will
> need to delete. 
> 
> I thought I would get some help here and hence I posted. once
> again... sorry to bother 

You don't appear to be asking for help, you appear to be asking for someone to write it for 
you. "Asking for help" consists of "this is what I want, here's what I tried, this is what 
happened, how can I fix it?"

As Jerry already told you: we are not unpaid consultants. 

[toc] | [prev] | [next] | [standalone]


#14060

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-07-04 02:34 +0000
Message-ID<lp53sj$kac$1@dont-email.me>
In reply to#14056
On Thu, 03 Jul 2014 18:31:10 -0700, maxinetindia wrote:

> I am a newbie with no knowledge of php.

Hwere is the url for the online manual;:

http://www.php.net/manual/en/index.php

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#14061

Frommaxinetindia@gmail.com
Date2014-07-03 19:50 -0700
Message-ID<728816b1-ed7f-447f-97ad-03210b73066d@googlegroups.com>
In reply to#14060
On Friday, July 4, 2014 8:04:59 AM UTC+5:30, Denis McMahon wrote:
> On Thu, 03 Jul 2014 18:31:10 -0700, maxi wrote:
> 
> 
> 
> > I am a newbie with no knowledge of php.
> 
> 
> 
> Hwere is the url for the online manual;:
> 
> 
> 
> http://www.php.net/manual/en/index.php
> 
> 
> 
> -- 
> 
> Denis McMahon, 

Thank you Jerry and Denis. 

[toc] | [prev] | [next] | [standalone]


#14065

FromArno Welzel <usenet@arnowelzel.de>
Date2014-07-05 03:21 +0200
Message-ID<53B7531B.2040907@arnowelzel.de>
In reply to#14056
maxinetindia@gmail.com, 2014-07-04 03:31:

> I am a newbie with no knowledge of php. i have a register.php file
> with piece of code in ..... tag that asks for username password and
> other details. The country is selected automatically and the script
[...]

If you are going to use that on a public server - stop right now!

Hire someone to do the job for you or LEARN first.

Otherwise you will end up with a web site which is open to hackers who
will find the security problems in your PHP scripts.



-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web