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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:34:33+00:00 2026-05-28T20:34:33+00:00

I’m trying to embed a variable in a block of code that I’m writing

  • 0

I’m trying to embed a variable in a block of code that I’m writing with php into a text area so it can be easily selected and copied to another web site. In production, the variables will be pulled from SESSION variables, but for you to be able to try this if you want by pasting it onto a page, I’ve hard wired the variable values.

The problem is that the php function is not picking up the variables. I’ve tried it with SESSION variables that exist before the page is written –no go. I’ve also tried loading variables into a form on the page and getting them through $_POST…no go.
What am I doing wrong here?

<?php session_start();
$fkey ="46"; 
$bleft = "0.86543";
$bpos = "tp";
$bcolor = "#eb9494";
$blabel = "CALL US";
echo "fkey:  " . $fkey . "<br/>" ; 
echo "bleft:  " .$bleft . "<br/>" ;
echo "bpos:  " .$bpos . "<br/>" ; 
echo "bcolor:  " .$bcolor . "<br/>" ; 
echo "blabel:  " .$blabel . "<br/>" ; 


      $updateGoTo = null;
  switch ($thepos) {
    case "tp":
  $updateGoTo = "slideouttesttopDATA.php";
  build_HTMLtp();
  break;    
case "bt":
         $updateGoTo ="slideouttestbtmDATA.php";
      build_HTMLbt();
      break; 
     case "lt":
           $updateGoTo = "slideouttestltDATA.php";
        build_HTMLlt();
  break; 
case "rt":
       $updateGoTo = "slideouttestrtDATA.php";
        build_HTMLrt();
  break; 
   }

  ?>
<html>
<body>
    <form action="myform" method="post" enctype="application/x-www-form-urlencoded">

<?php 

function build_HTMLtp() {

    $myfield="&lt;style&gt;\n";
    //style blocks
    $myfield.=
"#slideouttop:{
    position:absolute;
    width:190px;height:187px;
    top:-238px;
    left:50%%;
}

.bizzopop,.bizzopopbtm{
    background:url(http://dev.bizzocall.com/images/bcpopupwtrans.png);
    background-repeat:no-repeat;
    height:auto;
    width:201px;
    overflow:visible;
    min-height:237px;
}
#clickmetop,#clickmebtm {
    float:left;
    clear:left;
    height:20px;
    width:80px;
}
#bcbuttontop,#bcbuttonbtm{
    background-color:#000000;
    position:relative;
    cursor:pointer;
    float:left;
    clear:left;
    left:0;
    height:30px;
    width:140px;
    overflow:hidden;
}
.bcsquarebtntop,.bcsquarebtnbtm{
    position:relative;
    background-color:#000000;
    float:left;
    clear:left;
    border:#ffFFFF;
    width:15px;
    height:15px;
    border-width:2px;
    border-style:solid;
    left:6px;
    top:5px;
}

.innersquarebtn{
    background-color:#ffffff;
    width:3px;
    height:3px;
    margin:auto;
    margin-top:6px;
    position:relative;  
}

.btnlabeltxttop{
    cursor:pointer;
    display:inline;
    overflow:visible;
    height:40px;
    width:100%%;
    text-align:left;
    text-indent:0;
    left:0px;
    position:relative;
    float:left;
    font-size:17px;
    font-weight:bold;
    color:#00FFFF;
    top:-23px;
    margin-left:32px;
}\n";
//special handling for variables
$myfield.=".bizzopop {background-color:" . $bcolor . ";}\n";

$myfield.=".btnlabeltxttop {color:". $bcolor .";}\n";

$myfield.="#slideouttop {
    left:". 100*($bleft) ."%%;
    display:". $tp .";
}

    #clickmetop {
    position:relative;
    float:left;
    clear:left;
    height:20px;
    width:80px;
    z-index:1000;
}
&lt;/style&gt;\n\n";
//now the html
$myfield.= "<div id=\"slideouttop\">
<div class=\"bizzopop\">
</div>
 <div id=\"clickmetop\">
<div id=\"bcbuttontop\">
  <div class=\"bcsquarebtntop\">
    <div class=\"innersquarebtn\"></div>
  </div>
  </div>
  <div class=\"btnlabeltxttop\">". $blabel ."</div>
</div>
</div>\n\n";
//jquery handlers
$myfield.="<script src=" . "\"http://" . "code.jquery.com/jquery-latest.js\">        </script>\"\n
$(function() {\n
    $(\'#clickmetop\).toggle(function() {\n
        $(this).parent().animate({marginTop:\'187px\'}, {queue:false, duration:     500});\n
    }, function() {\n
        $(this).parent().animate({marginTop:\'0px\'}, {queue:false, duration:     500});\n
    });\n
});\n
</script>
";

  printf ($myfield);

}

?>

<textarea name="myfield" cols="100" rows="30"><?php build_HTMLtp();?>
</textarea>
</form>
  • 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-28T20:34:34+00:00Added an answer on May 28, 2026 at 8:34 pm

    Global variables are not accessible inside functions unless you use global or access them via the $GLOBALS-array.

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

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to understand how to use SyndicationItem to display feed which is

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.