1

I'm trying to send this varabile from one page to another but there is no value in it when I send it

I stored the value in compInfo.php

in compInfo2.php

      <?php
        if (isset($_POST['savebutton'])) {
            $company = new copmany();
            $copmnae = $_POST['CName'];
            $COMPNAME = $copmnae;
      ?>

I dont know whats wrong

  <a href='compInfo2.php?$copmnae=$GLOBALS["COMPNAME"]' > شاهد سيرتك الذاتية من هنا </a>

3 Answers 3

3

I dont really understand the problem but this is suspicious :

<a href='compInfo2.php?$copmnae=$GLOBALS["COMPNAME"]' > شاهد سيرتك الذاتية من هنا </a>

should be

echo  "<a href='compInfo2.php?CName={$COMPNAME}' > شاهد سيرتك الذاتية من هنا </a>";

or

<a href='compInfo2.php?CName=<?php echo $COMPNAME ?>' > شاهد سيرتك الذاتية من هنا </a>
Sign up to request clarification or add additional context in comments.

Comments

1

Try like this

<a href="compInfo2.php?CName=<?php echo $GLOBALS['COMPNAME'];?>"> شاهد سيرتك الذاتية من هنا </a>

Comments

0

You also trying to send a $_GET data to the second file, then getting it there as a post data.

so if you want to keep it as get data, you should change $copmnae = $_POST['CName'];

to

 $copmnae = $_GET['CName'];

beside converting compInfo2.php?$copmnae=$GLOBALS["COMPNAME"] to

 compInfo2.php?CName=<?=$GLOBALS["COMPNAME"]?>

note the compnae name difference, because over in the second file you are getting the wrong name from the one you are sending.

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.