Results 1 to 7 of 7

Thread: Passing sql data to a 2nd php file

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Passing sql data to a 2nd php file

    I have a php script running fine which allows an "admin" to insert/change their email address and stores it in the SQL database. My problem is that I am using a 2nd php script which is just a simple "contact me" form which emails the admin the form results.

    I want the admin email (recipiant) for the "contact me" form to be the email address found in the database. Within the contact me form I have the variable:

    VB Code:
    1. $recipiant = "[email protected]";  //please replace this with your address

    This script connects with the database just fine, I just dont know what code to insert in order for the email address in the database to be used along with this script. Any suggestions would be greatly appreciated.

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Passing sql data to a 2nd php file

    honestly, after reading what you said, I have absolutely no clue what you're trying to do at all.. so I'm going to try to piece it together:

    your title says you want to pass some SQL data to a second PHP file. that's fine, all you need to do is insert the data with an ID and then load the second page with a POST, GET, COOKIE or SESSION variable containing that ID. then, you just have to select that data from the database where the ID in the database is equal to the ID in the variable and print out the data or use it for whatever.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Re: Passing sql data to a 2nd php file

    For example, in the database the admin email address is saved as "adminemailaddress". I want the contact me form to email the form results to "adminemailaddress". I don't want the email address to be displayed on the page like an echo command would do, I just want the script to see what the email address is within the database without displaying anything on the page.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Passing sql data to a 2nd php file


  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Re: Passing sql data to a 2nd php file

    Quote Originally Posted by sitefever
    I have a php script running fine which allows an "admin" to insert/change their email address and stores it in the SQL database. My problem is that I am using a 2nd php script which is just a simple "contact me" form which emails the admin the form results.

    I want the admin email (recipiant) for the "contact me" form to be the email address found in the database. Within the contact me form I have the variable:

    VB Code:
    1. $recipiant = "[email protected]";  //please replace this with your address

    This script connects with the database just fine, I just dont know what code to insert in order for the email address in the database to be used along with this script. Any suggestions would be greatly appreciated.

    After much headache, here was the solution:

    VB Code:
    1. $nasaadresa = "{$arow['adminemailaddress']}";  //please replace this with your address

    Works fine.

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Passing sql data to a 2nd php file

    Oh of course, I should have guessed. Such an obvious solution, how foolish of me.

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Re: Passing sql data to a 2nd php file

    I appreciate your assistance. Thank you!

Posting Permissions

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



Click Here to Expand Forum to Full Width