FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » if condition in php syntax required
Show: Today's Messages :: Unread Messages :: Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
if condition in php syntax required [message #186341] Thu, 03 July 2014 21:31 Go to next message
maxinetindia is currently offline  maxinetindia
Messages: 3
Registered: July 2014
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
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
Message by Jerry Stuckle is ignored  [reveal message]  [reveal all messages by Jerry Stuckle]  [stop ignoring this user] Go to previous messageGo to next message
Re: if condition in php syntax required [message #186343 is a reply to message #186342] Thu, 03 July 2014 21:54 Go to previous messageGo to next message
maxinetindia is currently offline  maxinetindia
Messages: 3
Registered: July 2014
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
On Friday, July 4, 2014 7:15:42 AM UTC+5:30, Jerry Stuckle wrote:
> On 7/3/2014 9:31 PM, maxi(at)gmail(dot)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(at)attglobal(dot)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
Message by Jerry Stuckle is ignored  [reveal message]  [reveal all messages by Jerry Stuckle]  [stop ignoring this user] Go to previous messageGo to next message
Re: if condition in php syntax required [message #186345 is a reply to message #186341] Thu, 03 July 2014 22:34 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
remove from buddy list
ignore all messages by this user
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(at)gmail(dot)com
Re: if condition in php syntax required [message #186346 is a reply to message #186345] Thu, 03 July 2014 22:50 Go to previous messageGo to next message
maxinetindia is currently offline  maxinetindia
Messages: 3
Registered: July 2014
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
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.
Re: if condition in php syntax required [message #186347 is a reply to message #186343] Fri, 04 July 2014 13:02 Go to previous messageGo to next message
Doug Miller is currently offline  Doug Miller
Messages: 171
Registered: August 2011
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
maxinetindia(at)gmail(dot)com wrote in
news:59b9e94d-081f-4374-b86f-93879f61491a(at)googlegroups(dot)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.
Re: if condition in php syntax required [message #186351 is a reply to message #186341] Fri, 04 July 2014 21:21 Go to previous message
Arno Welzel is currently offline  Arno Welzel
Messages: 317
Registered: October 2011
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
maxinetindia(at)gmail(dot)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
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: how to revise my User Contributed Note on php.net
Next Topic: xmltes Template Engine
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Jan 21 08:05:18 EST 2025

Total time taken to generate the page: 0.05205 seconds