×
UNIX.COM Login
Username:
Password:  
Show Password






👤


Web Programming

Discuss Web Programming and Web Server Administration, including LAMP, Apache, MySQL, HTML, SEO, and other Web APIs and topics.

How to create a link that will display the contents of a PHP variable?

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #8  
Old 02-09-2018
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 16 July 2018, 3:49 PM EDT
Location: Saskatchewan
Posts: 22,724
Thanks: 1,192
Thanked 4,349 Times in 4,005 Posts
Quote:
Originally Posted by crimso View Post
Correct, I could but this a PHP script that is in the machine's /var/www/html directory that you point your browser at.
Yes, it is; I'm not sure how this prevents you from printing something.

Your PHP script - and most other CGI scripts like it - don't interact with a web browser in real-time, it runs once on page load then quits. Your program has already quit by the time someone is looking at its output, and clicking would either cause another page load (of the same script or a different one), or trigger something to happen in the page's HTML, or execute a javascript program.

The simplest way would be to use HTML expanding sections, like this:

Code:
<details>
    <summary>Clickable Part</summary>
    Hidden Part
</details>

Sponsored Links
    #9  
Old 02-10-2018
crimso crimso is offline
Registered User
 
Join Date: Jun 2010
Last Activity: 10 February 2018, 8:25 AM EST
Location: michigan
Posts: 75
Thanks: 25
Thanked 4 Times in 4 Posts
Well thanks for that! Finally it makes sense why I've not been able to do what I thought I should be able to do. So creating the link that launches another script that runs the rpm makes the most sense to get what I want. On the front end it doesn't look any different than what I wanted it just means I need the href line in the original script and the script it calls. Thank-you kindly @Corona688 for chiming in.
Sponsored Links
    #10  
Old 02-12-2018
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 16 July 2018, 3:49 PM EDT
Location: Saskatchewan
Posts: 22,724
Thanks: 1,192
Thanked 4,349 Times in 4,005 Posts
Quote:
Originally Posted by crimso View Post
Well thanks for that! Finally it makes sense why I've not been able to do what I thought I should be able to do. So creating the link that launches another script that runs the rpm makes the most sense to get what I want. On the front end it doesn't look any different than what I wanted it just means I need the href line in the original script and the script it calls. Thank-you kindly @Corona688 for chiming in.
You could also do so using the same script, doing different things when called with different parameters. See http://path/to/script.php?value1=a&value2=b, the $_GET superglobal, and array_key_exists($_GET,"key"
);
Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
awk to create variables to pass into a bash loop to create a download link cmccabe Shell Programming and Scripting 8 09-27-2016 12:51 PM
HTML: Display contents of file using Variable scott_cog UNIX for Dummies Questions & Answers 4 10-25-2013 12:34 PM
Folder contents getting appended as strings while redirecting file contents to a variable vivek d r Shell Programming and Scripting 2 03-29-2013 04:13 AM
What are the contents of a symbolic link? krishnampkkm UNIX for Dummies Questions & Answers 1 03-08-2010 08:15 AM



All times are GMT -4. The time now is 12:11 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.