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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:36:36+00:00 2026-05-16T05:36:36+00:00

I am trying to display different divs depending on a selection from a drop

  • 0

I am trying to display different divs depending on a selection from a drop down menu.

 <html>
<head>
<title>DDlist Div Display</title>
<script type="text/javascript">
function ShowDivArea(info) {
  var sel = document.getElementById('divArea').getElementsByTagName('div');  
  for (var i=0; i<sel.length; i++) { sel[i].style.display = 'none'; }
  if (info == '0') { return; }
  document.getElementById('divArea'+info).style.display = 'block';
}

</script>

<style type="text/css">
.divArea { display:none; height:100px; width:500px; border:1px solid red; }
</style>

</head>

    <body>

<select id="DDDivList" onchange="ShowDivArea(this.selectedIndex)">
  <option value="0" selected> -- Select A Design Service --</option>
  <option value="1"> QR Bookmark </option>
  <option value="2"> Twitter </option>
  <option value="3"> Ning or Tumblr </option>
  <option value="4"> Flyers </option>
  <option value="5"> Business Card or Brochure</option>
  <option value="6"> Album or Mixtape cover</option>
  <option value="7"> Other</option>
</select>

<div id="divArea">
 <div id="divArea1" class="divArea">

 <form action='code.php' method='GET'>
    <input type='text' name='myname'><br>
    <input type='submit' value='Click here'>
</form>

<?php


$name = $_GET['myname'];
if ($name)
echo "Hello, $name.";


?>


</div>
 <div id="divArea2" class="divArea">
</div>
</body>
</html>

You get the point from here on. More divs for each drop down option.

This is what I don’t get: I want to add a different php script to each div. What should code.php be?

Thank you.

  • 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-16T05:36:37+00:00Added an answer on May 16, 2026 at 5:36 am

    This is what I don’t get: I want to add a different php script to each div. What should code.php be?

    You could include it, or simple insert it inline like you are currently doing.

    Also, code.php can be anything you want. You’ll probably want it to handle $_GET['myname'].

    If you actually want code.php to be included there, try this

    include 'code.php';
    

    On a security note, echoing $name like that could leave you open to an XSS vulnerability, unless you escaping the $_GET super global of course (which is probably too much of a blanket solution).

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

Sidebar

Related Questions

I'm trying to display different information depending on incoming data. If it's an integer,
Hello I am trying to display two different html pages through the same UIViewController
So I'm trying to get my TabItem to display a different image depending on
Hi every one i'm trying to create two divs. One div has a different
I am trying to have every viewController to display different layout depending on the
I'm trying to create a div containing 3 different divs: the header, the content
I'm trying to display a page in NSIS to obtain two different values. I
I'm trying to use the show and hide to display a different set of
I am trying to display data that I am getting from server through json.
I am trying to display my popover menu whenever the user clicks on a

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.