Skip navigation
_AJD_TUS_
Currently Being Moderated

Send PHP/MySQL results to popup window as HTML

Mar 20, 2012 9:17 AM

Tags: #php #html #rendering #mysql

Hi all,

 

Not even sure if this can be done, but I have a Results.php page that includes a line:

 

"My task,  [<?php echo $row_Recordset1['Task'];?>], is in the top [<?php echo $row_Recordset1['RankPercent']; ?>] of tasks in the company";

 

...where the php tags represent results from a MySQL search.

 

How do I send this as html to a mini-popup window so that the people can send it to their friends on facebook/twitter/etc?

 

NOTE: the issue here isn't in creating a popup page - I can do this.

 

What I need to be able to do is pass that sentence to the popup.php page "exactly" as it appears on the page when rendered.

 

I have been experimenting down the...

 

$text = "My task, [<?php echo $row_Recordset1['Task'];?>], is in the top [<?php echo $row_Recordset1['RankPercent']; ?>] of tasks in the company";

 

...route, but this just gives a load of parse errors (predicably enough).

 

Any thoughts?

 
Replies
  • Currently Being Moderated
    Mar 20, 2012 9:44 AM   in reply to _AJD_TUS_

    I don't know php, but in most other languages variables should not appear within double quotes, otherwise they are interpreted as literal. So maybe:

     

    $text = "My task, [" . <?php echo $row_Recordset1['Task'];?>  . "], is in the top [" . <?php echo $row_Recordset1['RankPercent']; ?> . "] of tasks in the company";

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 12:26 AM   in reply to _AJD_TUS_

    You can use curly brackets to include the recordset values directly:

     

    $text = "My task, [{$row_Recordset1['Task']}], is in the top [{$row_Recordset1['RankPercent']}] of tasks in the company";

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points