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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:17:59+00:00 2026-06-01T10:17:59+00:00

i wrote in file showList.php the following form, which select items from the database

  • 0

i wrote in file showList.php the following form, which select items from the database and show them in drop-down list:

<form id="selForm" name="selForm" action="index.php" method="post">
<select name="selection" id="selection">
<option id="nothingSelected" >--Choose form---></option>
<?php

$con=mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("myDatabase",$con);
$result = mysql_query("SELECT * FROM formsTable");

while($row = mysql_fetch_array($result))
  {
  $selection_id=$row['id'];
if($_POST['selection']==$selection_id)$selElement="selected";
  echo "<option  id='$selection_id' name=\"sectionid\"  value='$selection_id' >";
  echo $row['nummer'] . " " . $row['titel']. " ";
  echo "</option>";
  }
?>

</select>
<input type="button" value="load form" onClick="validateForm(document.selForm)">
<input type="button" value="delete form" onClick="deleteForm(document.selForm);">
</form>

I include this file in index.php as follows:

<?php include('showList.php');?>

Now when I call index.php, a list of found forms will be displayed in a drop-down list.

This works fine in firefox, my Problem is when I call index.php in internetexplorer, I get the following error:

Notice: Undefined index: selection in C:\path\showList.php on line 43

Line 43 is:

if($_POST['selection']==$selection_id)$selElement="selected";

as you can see in the form above.
Any idea?

  • 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-06-01T10:18:00+00:00Added an answer on June 1, 2026 at 10:18 am

    You need to change the problem line from:

    if($_POST['selection']==$selection_id)$selElement="selected";
    

    to:

    if(isset($_POST['selection']) && ($_POST['selection']==$selection_id))
        $selElement="selected";
    

    to check that a value for (as @b1onic suggested).

    Obviously nothing will be POSTed the first time the form is shown in the browser – whichever browser you are using – so you will get that error.

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

Sidebar

Related Questions

I wrote a PHP file which should insert values in a MySQL database. I
Hey guys, PHP and MySQL newguy here. Wrote this php file which display the
I made an website with php and I wrote .htacess file in my htdocs
I wrote the following code to count the node of an XML file: private
I wrote this script which counts occurrences of particular pattern in a given file.
Here I wrote a C program which executes hi.sh file using system call. Here
I wrote a ruby file which can be used as a library. But in
I have a config.php file for one of my site which holds information needed
In order to load data (from a CSV file) into an Oracle database, I
I have extracted the Gray Value from an image file (format .3pi) and wrote

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.