I have problem with my application, when i try to insert record from custom html form from localhost i get
success response. But when i try to view records in the database view the record is
not there.
And if i
delete record from my view and then i try to insert new record i get success result and
the record is there i can see it in the view.
By the way i am sending the post request with php curl and it is working ok
Any help with this will be appreciated.
Here is the code:
- $apikey = "xxxxxxxxxxxxxxxxxxxxxx";
- $ticket = "xxxxxxxxxxxxxxxxxxxxxxxxx";
-
- $url = "https://creator.zoho.com/api/xml/write/apikey=$apikey&ticket=$ticket";
- $XMLString= "XMLString=<ZohoCreator>
- <applicationlist>
- <application name='xxxxxx'>
- <formlist>
- <form name='xxxxxxxxxxx'>
- <add>
- <field name='Title'>
- <value>".$_POST['title']."</value>
- </field>
- <field name='full_name'>
- <value>".$_POST['fullName']."</value>
- </field>
- <field name='Sex'>
- <value>".$_POST['sex']."</value>
- </field>
- <field name='Date_of_Birth'>
- <value>".$_POST['birthDate']."</value>
- </field>
- <field name='TaxNumber'>
- <value>".$_POST['taxNumber']."</value>
- </field>
- <field name='Mobile_Number'>
- <value>".$_POST['mobileNum']."</value>
- </field>
- <field name='Email'>
- <value>".$_POST['email']."</value>
- </field>
- <field name='Business_Address'>
- <value>".$_POST['bussAddses']."</value>
- </field>
- <field name='Subrb'>
- <value>".$_POST['subrb']."</value>
- </field>
- <field name='State'>
- <value>".$_POST['state']."</value>
- </field>
- <field name='Post_Code'>
- <value>".$_POST['postcode']."</value>
- </field>
- <field name='is_postal_address'>
- <value>".$_POST['isPostalAddress']."</value>
- </field>";
- //Postal Address
- if(!empty($_POST['postalAddressOpt'])){
- $XMLString .= "<field name='Postal_Address'>
- <value>".$_POST['postalAddressOpt']."</value>
- </field>";
- }
- //Subrb Postal
- if(!empty($_POST['subrbPostalOpt'])){
- $XMLString .= "<field name='Subrb_Postal'>
- <value>".$_POST['subrbPostalOpt']."</value>
- </field>";
- }
- //State Postal
- if(!empty($_POST['statePostalOpt'])){
- $XMLString .= "<field name='State_Postal'>
- <value>".$_POST['statePostalOpt']."</value>
- </field>";
- }
- //Post Code Postal
- if(!empty($_POST['postCodePostalOpt'])){
- $XMLString .= "<field name='Post_Code_Postal'>
- <value>".$_POST['postCodePostalOpt']."</value>
- </field>";
- }
- $XMLString .= "<field name='c_bussiness'>
- <value>".$_POST['businessIn']."</value>
- </field>
- <field name='a_contractor'>
- <value>".$_POST['aContractor']."</value>
- </field>";
- //Contractor checkboxes
- if(!empty($_POST['contractorOpt'])){
- $XMLString .= "<field name='applicable_t'>
- <value>".$_POST['contractorOpt']."</value>
- </field>";
- }
- $XMLString .= "<field name='ft_business'>
- <value>".$_POST['ft_business']."</value>
- </field>";
- //Contractor checkboxes
- if(!empty($_POST['previousANum'])){
- $XMLString .= "<field name='Your_previous_ABN_if_you_remember'>
- <value>".$_POST['previousANum']."</value>
- </field>";
- }
- //Optional Trading name
- if(!empty($_POST['tradingNameOptional'])){
- $XMLString .= "<field name='Trading_Name_optional'>
- <value>".$_POST['tradingNameOptional']."</value>
- </field>";
- }
- $XMLString .= "<field name='ain_business'>
- <value>".$_POST['ain_business']."</value>
- </field>
- <field name='actdatebus'>
- <value>".$_POST['actdatebus']."</value>
- </field>
- <field name='w_register'>
- <value>".$_POST['w_register']."</value>
- </field>";
- //Optional Trading name
- if($_POST['w_register'] == "Yes" && !empty($_POST['anne']) && !empty($_POST['goffs']) && !empty($_POST['repat'])){
- $XMLString .= "<field name='What_is_your_estimated_annual_earning'>
- <value>".$_POST['anne']."</value>
- </field>
- <field name='When_will_you_forward_the_GST_to_the_Tax_Office'>
- <value>".$_POST['goffs']."</value>
- </field>
- <field name='How_often_would_you_like_to_report_to_the_ATO'>
- <value>".$_POST['repat']."</value>
- </field>";
- }
-
- $XMLString .= "</add>
- </form>
- </formlist>
- </application>
- </applicationlist>
- </ZohoCreator>";
- $ch = curl_init ($url);
- curl_setopt ($ch, CURLOPT_POST, 1);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $XMLString);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_VERBOSE, 1);
- curl_setopt($ch, CURLOPT_NOBODY, 0);
- $returndata = curl_exec ($ch);
- curl_close($ch);
- echo $returndata;