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

  • Home
  • SEARCH
  • 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 9159941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:36:59+00:00 2026-06-17T13:36:59+00:00

I’m sorry but this is my first question on here. I’m doing my school

  • 0

I’m sorry but this is my first question on here. I’m doing my school project of making an app and is having difficulties with the sql php connection.

It’s posting blanks into the database.

I’m sorry for the format. I did not include the whole code, only the areas that I think affects my results.

Here’s my code:

Booking.h

#define kPostURL @"http://XXX/app/quickbooking.php"
#define kFirstname @"firstname"
#define kLastname @"lastname"
#define kContactno @"contactno"
#define kEmail @"email"
#define kClub @"club"
#define kDatetime @"datetime"



@interface TellUs : UIViewController <UINavigationControllerDelegate, UIActionSheetDelegate, UITextFieldDelegate,UIPickerViewDataSource, UIPickerViewDelegate,UITextFieldDelegate, SKPSMTPMessageDelegate>{

IBOutlet UITextField *messageText;
IBOutlet UITextField *messageTextName;
IBOutlet UITextField *messageTextLastName;
IBOutlet UITextField *messageTextEmail;
IBOutlet UIButton *doneEditingButton;
IBOutlet UIButton *sendMail;
IBOutlet UILabel *feedbackMsg;
IBOutlet UIDatePicker *myDatePicker;
IBOutlet UITextField *yourTextField;
IBOutlet UIToolbar  *toolBar;
IBOutlet UIBarButtonItem *barButton;
IBOutlet UISegmentedControl *segmentedControl;
IBOutlet UILabel *myDatePickerLabel;
IBOutlet UILabel *myPickerLabel;
IBOutlet UIPickerView *myPicker;
IBOutlet UITextField *yourTextFieldPicker;
IBOutlet UIButton *tellUsWhatYouThink;
NSArray *dataSource;
NSArray *fieldsArray;
CGFloat             animatedDistance;

IBOutlet UIButton *postBooking;
NSURLConnection *postConnection;


}

@property (nonatomic, retain) UITextField *messageText;
@property (nonatomic, retain) UITextField *messageTextName;
@property (nonatomic, retain) UITextField *messageTextLastName;
@property (nonatomic, retain) UITextField *messageTextEmail;
@property (nonatomic, retain) UIButton *doneEditingButton;
@property (nonatomic, retain) UIButton *sendMail;
@property (nonatomic, retain) UILabel *feedbackMsg;
@property (nonatomic, retain) UISegmentedControl *segmentedControl;
@property (nonatomic, retain) UIButton *tellUsWhatYouThink;
@property (nonatomic, retain) UIDatePicker *myDatePicker;
@property (nonatomic, retain) UITextField *yourTextField;
@property (nonatomic, retain) UILabel *myDatePickerLabel;
@property (nonatomic, retain) UILabel *myPickerLabel;
@property (nonatomic, retain) UIPickerView *myPicker;
@property (nonatomic, retain) NSArray *dataSource;
@property (nonatomic, retain) UITextField *yourTextFieldPicker;
@property (nonatomic, retain) IBOutlet UITextView *textView;

@property (nonatomic, retain) UIButton *postBooking;


-(void) postFirstname:(NSString *)firstname withLastname:(NSString *)lastname withContactno:(NSString *)contactno withEmail:(NSString *)email withClub:(NSString *)club withDatetime:(NSString *)datetime;


- (IBAction)postBooking:(id)sender;

@end

Booking.m

@synthesize feedbackMsg;
@synthesize tellUsWhatYouThink;
@synthesize sendMail;
@synthesize doneEditingButton;
@synthesize messageText;
@synthesize messageTextName;
@synthesize messageTextLastName;
@synthesize messageTextEmail;
@synthesize myDatePicker, yourTextField, segmentedControl;
@synthesize myDatePickerLabel;
@synthesize myPickerLabel, myPicker, dataSource;
@synthesize yourTextFieldPicker;
@synthesize textView;

@synthesize postBooking;

-(void) postFirstname:(NSString *)firstname withLastname:(NSString *)lastname withContactno:(NSString *)contactno withEmail:(NSString *)email withClub:(NSString *)club withDatetime:(NSString *)datetime {


if (firstname != nil && lastname != nil && contactno != nil
    && email != nil && club != nil && datetime != nil){

    NSMutableString *postString = [NSMutableString stringWithString:kPostURL];
    [postString appendString:[NSString stringWithFormat:@"?%@=%@", kFirstname, firstname]];        
    [postString appendString:[NSString stringWithFormat:@"&%@=%@", kLastname, lastname]];        
    [postString appendString:[NSString stringWithFormat:@"&%@=%@", kContactno, contactno]];        
    [postString appendString:[NSString stringWithFormat:@"&%@=%@", kEmail, email]];        
    [postString appendString:[NSString stringWithFormat:@"&%@=%@", kClub, club]];        
    [postString appendString:[NSString stringWithFormat:@"&%@=%@", kDatetime, datetime]];        
    [postString setString:[postString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postString]];
    [request setHTTPMethod:@"POST"];        
    postConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];

     }
}

-(IBAction)postBooking:(id)sender{

[self postFirstname: messageTextName.text withLastname: messageTextLastName.text withContactno: messageText.text withEmail: messageTextEmail.text withClub: myPickerLabel.text withDatetime: myDatePickerLabel.text];

[messageTextName resignFirstResponder];

messageTextName.text = nil;
messageTextLastName.text = nil;
messageText.text = nil;
messageTextEmail.text = nil;
myPickerLabel.text = nil;
myDatePickerLabel.text = nil;

[self.navigationController popViewControllerAnimated:YES];

}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];

}

- (void)viewDidUnload {

}


- (void)dealloc {

[segmentedControl release];
[myDatePickerLabel release];
[myPickerLabel release];
[myPicker release];
[dataSource release];   
[super dealloc];
[sendMail release]; 
[messageText release];  
[doneEditingButton release];
[fieldsArray release];
[feedbackMsg release];
[tellUsWhatYouThink release];
[messageTextName release];
[messageTextLastName release];
[messageTextEmail release];
[yourTextField release];
[yourTextFieldPicker release];

[postBooking release];

}


@end

PHP file:

<?php 
session_start();
include("connectdb.php");
$first_name = $_GET['messageTextName'];
$last_name = $_GET['messageTextLastName'];
$contactno = $_GET['messageText'];
$email = $_GET['messageTextEmail'];
$club = $_GET['myPickerLabel'];
$date_time = $_GET['myDatePickerLabel'];
$query = "INSERT INTO booking VALUES ('', '$first_name', '$last_name', '$contactno', '$email', '$club', '$date_time')";
mysql_query($query) or die (mysql_error("ERROR"));
mysql_close();
?>
  • 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-17T13:37:00+00:00Added an answer on June 17, 2026 at 1:37 pm

    In server side (PHP) you using $_GET global variable, but in xcode you set POST method

    [request setHTTPMethod:@"POST"];
    

    Change in php file

    $_GET to $_POST or to $_REQUEST.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am writing an app for my school newspaper, which is run completely online
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.