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 7673155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:26:48+00:00 2026-05-31T16:26:48+00:00

So I am trying to integrate fedex for web services in php. The form

  • 0

So I am trying to integrate fedex for web services in php. The form before this gets all the necessary items for the receiver of the package. All my code works all the way up until I try to add the $postal variable from the form, if I hard code 85308 into ‘PostalCode’ => ‘85308’ it works, but if I replace ‘85308’ with ”.$postal.” it does not work. it gives me the error Message: Destination postal code missing or invalid.

I have used trim() on the variable changed its name all that good stuff still a no go.

any ideas or opinions would be greatly appreciated my code is below.

Thanks

<?php
//get address information$fname = $_POST["fname"];
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$state = $_POST["state"];
$address1 = $_POST["address1"];
$address2 = $_POST["address2"];
$postal = $_POST["zip"];
$city = $_POST["city"];
$fullname = $fname." ".$lname;
$fulladdress = $address1." ".$address2;

function addRecipient(){
    $recipient = array(
        'Contact' => array(
            'PersonName' => ''.$fullname.'',
            'CompanyName' => 'Company Name',
            'PhoneNumber' => '9012637906'
        ),
        'Address' => array(
            'StreetLines' => array(''.$fulladdress.''),
            'City' => ''.$city.'',
            'StateOrProvinceCode' => ''.$state.'',
            //'PostalCode' => '85308',
            'PostalCode' => ''.$postal.'',
            'CountryCode' => 'US',
            'Residential' => false)
    );
    return $recipient;                  
}
  • 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-05-31T16:26:49+00:00Added an answer on May 31, 2026 at 4:26 pm

    Inside the function, the variables are outside of your scope. See http://php.net/manual/en/language.variables.scope.php

    Solutions:

    • Import the variables inside the function
    • Import the variables as parameters to your function
    • Use globals (ugly)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to integrate a public message board service into an existing web site.
I'm trying to integrate the FedEx tracking class into my application. The class takes
I am trying to integrate NHibernate.Search into a multi-lingual website. Now, this website contains
I am trying to integrate OpenFeint 2.12.5 into my app. I already read this
I am trying to integrate facebook with android mobile, all i need to do
So I'm trying to integrate the PHP facebook SDK/API with codeigniter, because I love
I'm trying to integrate Jawr into my Spring application: <bean abstract=true id=jawrBase class=net.jawr.web.servlet.JawrSpringController> <property
I am trying to integrate this particular app in my website. When I load
I am trying to integrate openid authentication in asp.net 4 following this article .
trying to integrate hibernate and spring ,I ran into this error SEVERE: Context initialization

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.