Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9057415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:26:58+00:00 2026-06-16T14:26:58+00:00

I am newbie for iPhone application. I have followed this tutorial for login from

  • 0

I am newbie for iPhone application. I have followed this tutorial for login from iPhone.

I have php file as below.

index.php

<?php
$user = $_POST['uname'];

if ($user == 'user') {
    echo "Welcome to my site...";
} else {
    echo "Invalid User";
}
?>

When I run application and enter username as user and password as some text, I get output as Welcome to my site….

Now instead of welcome message, I wanna go to my welcome screen i.e. View Controller that I have on story board. Any idea how to get this done?

Full code is as below.

-(IBAction)buttonClick:(id)sender
{
    greeting.text= @"";
    NSString* username = nameInput.text;
    NSString* pass = passInput.text;
    greeting.hidden = NO;
    if([nameInput.text isEqualToString:@"" ] && [passInput.text isEqualToString:@""])
    {
        greeting.text = @"Please enter username and password.";
        [nameInput resignFirstResponder];
        [passInput resignFirstResponder];
        return;
    }

    if([nameInput.text isEqualToString:@"" ])
    {
        greeting.text = @"Please enter username.";
        [nameInput resignFirstResponder];
        [passInput resignFirstResponder];
        return;
    }

    if([passInput.text isEqualToString:@""])
    {
        greeting.text = @"Please enter password.";
        [nameInput resignFirstResponder];
        [passInput resignFirstResponder];
        return;
    }


    NSString *post = [[NSString alloc] initWithFormat:@"uname=%@&pwd=%@",username,pass];

    NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

    NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

    NSURL *url = [NSURL URLWithString:@"http://localhost:8888/PhPTesting/index.php"];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPBody:postData];


    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

    if( theConnection )
    {
        indicator.hidden = NO;
        webData = [[NSMutableData data] retain];
    }
    else
    {

    }

    [nameInput resignFirstResponder];
    [passInput resignFirstResponder];
    nameInput.text = nil;
    passInput.text = nil;
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [webData setLength: 0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [webData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    [connection release];
    [webData release];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
    greeting.text = loginStatus;
    [loginStatus release];

    [connection release];
    [webData release];
    indicator.hidden = YES;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:26:59+00:00Added an answer on June 16, 2026 at 2:26 pm

    You can do this :

    if ([loginStatus isEqualToString:@"Welcome to my site..."]) {
        // Show welcome view controller
        NextViewController *nextViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"myNextView"];
        [self.navigationController pushViewController:nextViewController animated:YES];
    } else {
        greeting.text = @"Login was not correct";
    }
    

    Here , @”myNextView” is a NextView Identifier.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am newbie for iPhone application. I have followed this tutorial for login from
I am newbie for iPhone application. For storing data, I am following this tutorial
I'm a newbie doing Objective-C, coming from Flex/Actionscript development. I have an iPhone app
I am a newbie in iPhone Development.I developed an iPhone Application and installed this
Hi i'm a newbie to iphone application development.. present i'm working on Picasa web
I am newbie for iPhone application and I want to create iPhone application based
I'm a relative newbie on iPhone app development but have successfully created a tab
another iPhone newbie question... I have the following: NSPersistentStoreCoordinator NSManagedObjectContext NSManagedObjectModel Is it possible
I am a newbie in iPhone development, doing my first app. I have some
I am a newbie to iPhone development and have some basic questions to ask

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.