SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    What's HTML?
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    1,701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been messing around with this script for a week with no luck. Finally, today during lunch the problem popped into my head.

    It's a simple script. Basically one function gathers information from the user and places them into the appropriate variables. Then, another function takes this information and inserts it to my MySQL database. So I ran the script over and over again, but blank fields would always turn up into the database.

    Duh! One function can't access variables from another function without a work-around. So how exactly do I do this? I was thinking that I would need to use reference variables and parameters to pass the variables through from function to function. Am I on the right track?

    Also could you point me to a lesson or some documentation to reference variables in PHP? Haven't used reference variables in a year and that was in C++, so I'm a little shaky.

    Thanks in advance!
    Ryan Kuhle - A Proud Advisor - Got Questions? Just Ask!
    Get your website started for less than $20! Click Here

  2. #2
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can define variables as global inside a function such as global $var1, $var2;

    then you can use them

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Washington State
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •