1

I have to create a PHP menu that can manage simple billing stuff.

I created a PHP page that generate a quote (create_quote.php). This page get an argument and I use a button <a href=\"create_quote.php?var=$id_patient\" >Create quote</a> to call this page.

I have another page that is pretty similar but this second page generate a billing (create_billing.php). Same story, I send an argument to get this document filled.

A billing can not be created if the quote was not generated before. I do not want a simple warning to display so I would like to create the quote if the billing is not created and the user clicked the 'Create billing' link anyway

I added this to my create_billing.php

if( /*The quote is not yet generated*/)
{
    include "create_quote.php?var='$myVarToSend'";
}
else
{
    ...
}

But it is not working. Do I have to make an Ajax call ? Why does it not work ?

1
  • What is not working? What errors do you get? What is the expected behaviour? Commented Sep 8, 2015 at 14:11

1 Answer 1

3

You don't need to pass variables in a $_GET string to an included page.

Simply define the variable and it will be available to the code within the include.

if( /*The quote is not yet generated*/)
{
    $var = $myVarToSend;
    include "create_quote.php";
}
else
{
    ...
}

The variable being sent will now be available as $var for the included file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.