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

  • SEARCH
  • Home
  • 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 6363741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:04:31+00:00 2026-05-25T00:04:31+00:00

<p>Todays Date: <? echo $date; ?></p> <p>Are you applying for a day, evening, or

  • 0
    <p>Todays Date: <? echo $date; ?></p>
    <p>Are you applying for a day, evening, or weekend class? 
    <select name='date' id='wclass'>
 <option value ='day'> Day</option>
 <option value ='evening'>Evening</option>
  <option value ='weekend'>Weekend</option>
  </select>


Program Start Date:
<div id='dates'></div>
<script language="javascript">
$(document).ready(function() {
{ setInterval(function () {

if ($("#wclass").val()=='day')

  {   $('#dates').html("<? echo <select name='date'>
<option value ='date1'> $start1 </option>
 <option value ='date2'>$start2</option>
 <option value ='date3'>$start3</option>
 <option value ='date4'>$start4</option>
  <option value ='date5'>$start5</option>
   <option value ='date6'>$start6</option>
   <option value ='date7'>$start7</option>
  </select> }?>");} 
  }, 1000); 
});

My issue is that i am not sure how to display php using javascript. The variables are all correct, the issue is to get the php to display as html would in my .html. All i want to do is display the php variables which i fetched in the beginning. So the variables have been defined in php now i want to turn them into a html list based on my javascript. You may notice that the echo is missing quotes, thats because i dont know how to put quotes, i cant use " or ' because they both interup quotes that are already there.

  • 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-25T00:04:31+00:00Added an answer on May 25, 2026 at 12:04 am

    Your javascript does not have access to your PHP variables, unless you request them via AJAX.

    However, you don’t have to use AJAX. You could use your PHP code to build the Javascript code before it is sent to the browser!!

    Here’s one way of doing it:

    <?php
        $start1 = '01/01/2010';
        $start2 = '11/11/2010';
        $start3 = '03/12/2010';
        // and so on...
    ?>
    <p>Today's Date: <?php echo $date; ?></p>
    <p>Are you applying for a day, evening, or weekend class?</p>
    
    <select name="date" id="wclass">
        <option value="day">Day</option>
        <option value="evening">Evening</option>
        <option value="weekend">Weekend</option>
    </select>
    
    
    Program Start Date:
    
    <div id="dates"></div>
    
    <script language="javascript">
    $(document).ready(function() {
    {
        $("#wclass").change(function ()
        {
            if( $(this).val() == 'day' )
            {
                $('#dates').html('<select name="date">\
                    <option value="date1"><?php echo $start1; ?></option>\
                    <option value="date2"><?php echo $start2; ?></option>\
                    <option value="date3"><?php echo $start3; ?></option>\
                    <option value="date4"><?php echo $start4; ?></option>\
                    <option value="date5"><?php echo $start5; ?></option>\
                    <option value="date6"><?php echo $start6; ?></option>\
                    <option value="date7"><?php echo $start7; ?></option>\
                </select>');
            } 
        }); 
    });
    </script>
    

    An even better option would be to just create the second select outright, and then show/hide it when needed:

    <?php
        $start1 = '01/01/2010';
        $start2 = '11/11/2010';
        $start3 = '03/12/2010';
        // and so on...
    ?>
    <p>Today's Date: <?php echo $date; ?></p>
    <p>Are you applying for a day, evening, or weekend class?</p>
    
    <select name="date" id="wclass">
        <option value="day" selected="selected">Day</option>
        <option value="evening">Evening</option>
        <option value="weekend">Weekend</option>
    </select>
    
    
    Program Start Date:
    
    <select id="dates" name="date">
        <option value="date1"><?php echo $start1; ?></option>
        <option value="date2"><?php echo $start2; ?></option>
        <option value="date3"><?php echo $start3; ?></option>
        <option value="date4"><?php echo $start4; ?></option>
        <option value="date5"><?php echo $start5; ?></option>
        <option value="date6"><?php echo $start6; ?></option>
        <option value="date7"><?php echo $start7; ?></option>
    </select>
    
    <script language="javascript">
    $(document).ready(function() {
    {
        $("#wclass").change(function ()
        {
            $(this).val() == 'day' ? $('#dates').show() : $('#dates').hide()
        }); 
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<p>Today's Date: <?php echo $date; ?></p> <p>Are you applying for a day, evening, or
I have to add one month to todays date and have to get date
I need to calculate an end date based on todays date and a number
Hey, I am trying to write a command to print todays date on the
In php i can get today date/day by using : $today = date('D, Y-m-d');
Hallo, I want to find the difference between today and another date, convert todays
This was working fine yesterday with no changes to the code. echo date(M, strtotime(-3
I have this query $query = mysql_query (SELECT type, count(*), date FROM tracking WHERE
// today is 03 Jan 2009 $datemonth = (int) date(md); if($datemonth == 0103){ echo
Hey i'm trying to display a date/time from a timestamp field using: echo $date

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.