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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:32:31+00:00 2026-05-13T13:32:31+00:00

I have a PHP file that handles sending out confirmation emails. I also have

  • 0

I have a PHP file that handles sending out confirmation emails. I also have a calendar that I use AJAX to do various updates. When AJAX calls the update file, it updates the database with the new information, and I want confirmation emails to be sent out.

So from inside the php file that the AJAX calls, I figured I should include("email-sender.php?stage=confirm2a&job={$slot->job_id} which calls the email php page, with the $_GET variables that tell it which emails to send and to who.

But for some reason, I can’t get the include to work when you use ?key=value $_GET pairs attached to the string. PHP.net tells me you can use $_GET variables in an include, but when I set up a simple test, it doesn’t appear to work.

My test page has one link, that when clicked submits an ajax call to a page along with data containing one variable “farm” which equals the value “animal”. Like this:

$("a.testlink").click(function() {
    var mydata = "farm=animal";
    $.ajax({
        url: "ajaxPHP.php",
        data: mydata,
        success: function(rt) {
            alert(rt);
        }
});

So ajaxPHP.php says:

if($_GET['farm']) {
    $var = $_GET['farm'];
    echo $var;
}

At this point, the success alert shows “animal” when the link is clicked. That’s right.

But if I change ajaxPHP.php to this:

if($_GET['farm']) {
    $var = $_GET['farm'];
    include("ajaxInclude.php?farm={$var}");
}

And have a file called ajaxInclude.php that says:

if($_GET['farm']) {
    $var = $_GET['farm'];
    echo $var;
}

Then when I click the link I get an empty alert. So the include doesn’t work with the query string appended to the end.

Any help?

ADDITION

So now I have the following:

$stage = "confirm2a";
include("email-sender.php");
$stage = "confirm2b";
include("email-sender.php");

And then in email-sender.php, obviously there is a lot of code like:

if($stage == "confirm2a") { 
   email Person 1 etc...
}
if($stage == "confirm2b") {
    email Person 2 etc...
}

But when I run the script, only Person 1 receives the email, and only once. Not sure why…

  • 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-13T13:32:31+00:00Added an answer on May 13, 2026 at 1:32 pm

    You can handle the variables within your included script, rather than appending them onto the include path itself:

    $var = "foo";
    include("script.php");
    

    — contents of script.php —

    echo $var; // 'foo'
    

    In my opinion this is much cleaner anyway. You may desire to check to make sure the values exist within script.php before echoing out any variables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 287k
  • Answers 287k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer $('#element').click(function() { if($('#radio_button').is(':checked')) { alert("it's checked"); } }); May 13, 2026 at 5:15 pm
  • Editorial Team
    Editorial Team added an answer Multiple backgrounds are only supported starting from Firefox 3.6 and… May 13, 2026 at 5:15 pm
  • Editorial Team
    Editorial Team added an answer The Microsoft .NET framework does not support XML 1.1, that… May 13, 2026 at 5:15 pm

Related Questions

I have a series of dynamically generated inputs that I need to have ajax
I've written a PHP script that handles file downloads, determining which file is being
I have a web app I'm building that has about 50 forms. I have
I own a community website of about 12.000 users (write heavy), 100 concurrent users
I have a feature in my app that handles and parses incoming emails. The

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.