Jump to content

Search the Community

Showing results for tags 'php variables'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 3 results

  1. Hey! I want to create a website that can test your counting pace. I’ll make colored, square div that change color after 10 to 30 seconds when you hover over it, and then you’ll type down how long you think it took in a form to check if you’re right. My solution to do this is to create the PHP variable $time = rand(10,30), and in CSS get the div:hover transition-delay to be $time. Then, after the form, I need the same variable for if($_POST[timeguess] = $time) {echo “Correct!”}. I have no idea how to access the same variable in both the CSS and HTML, so I hope some of you can help me out! Thanks
  2. I have an html form with a field for name, email, and comment. If you are not logged in you have to type these things in manually. They are then stored in javascript variables and run through ajax (which I did not bother to include). The PHP if statement below is supposed to detect if you are logged in, then replace the name and email variables with your username and email automatically (which are stored in PHP variables). The way I have it now does not work at all. How can I replace the value of the javascript variables with the contents of a PHP variable using an if-statement? <script type='text/javascript'> $('.bt-add-com').click(function(){ var theCom = $('.the-new-com'); var theName = $('#name-com'); var theMail = $('#mail-com'); <?php if($username && $userid) : ?> var theName = "<?php $username; ?>"; var theMail = "<?php $email; ?>"; <?php endif; ?> </script>
  3. Hey, I am trying to insert my variable into single quote marks. the following code works but does not put the single quote marks around the variable as it is part of the variable... <?php $user_id = get_current_user_id(); $files = glob('wp-content/uploads/'.$user_id.'/*'); natcasesort($files); foreach($files as $file) { echo '<img src="/' . $file . '" onclick="fakeClick(event, document.getElementById(' . $file . '))" />'; } ?> this appears as with now single quote around the emboldened.. <img src="/wp-content/uploads/1/portfolio-sample-main-image.png" onclick="fakeClick(event, document.getElementById(wp-content/uploads/1/portfolio-sample-main-image.png))"> however how I want to appear is as follows... <img src="/wp-content/uploads/1/portfolio-sample-main-image.png" onclick="fakeClick(event, document.getElementById('wp-content/uploads/1/portfolio-sample-main-image.png'))"> as you can see with single quotes... how can I do this? Thanks
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.