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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:48:23+00:00 2026-06-13T12:48:23+00:00

I have something strange going on with my application. Below is my code where

  • 0

I have something strange going on with my application. Below is my code where the user types in a courseid into a text input and submits the text input. If it finds the course from the DB then it displays the echo that course is found, else it states Course isn’t found. Now this works across all browsers (IE, Opera, Safari, Firefox and Chrome). Below is the code for this:

<h1>CREATING A NEW ASSESSMENT</h1>

<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<p>Course ID: <input type="text" name="courseid" /><input id="courseSubmit" type="submit" value="Submit" name="submit" /></p>      <!-- Enter User Id here-->
</form>

<?php
if (isset($_POST['submit'])) {

$query = "
SELECT cm.CourseId, cm.ModuleId, 
c.CourseName,
m.ModuleName
FROM Course c
INNER JOIN Course_Module cm ON c.CourseId = cm.CourseId
JOIN Module m ON cm.ModuleId = m.ModuleId
WHERE
(c.CourseId = ?)
ORDER BY c.CourseName, m.ModuleId
";

$qrystmt=$mysqli->prepare($query);
// You only need to call bind_param once
$qrystmt->bind_param("s",$courseid);
// get result and assign variables (prefix with db)

$qrystmt->execute(); 

$qrystmt->bind_result($dbCourseId,$dbModuleId,$dbCourseName,$dbModuleName);

$qrystmt->store_result();

$num = $qrystmt->num_rows();

if($num ==0){
echo "<p>Sorry, No Course was found with this Course ID '$courseid'</p>";
} else { 

echo "<p>Course Found: '$courseid'</p>";

}

But now I have decided to change the set up so instead of typing in the courseID in a text input, they can select a course ID from a drop down menu. So I change the code to this below:

$sql = "SELECT CourseId, CourseName FROM Course"; 

$sqlstmt=$mysqli->prepare($sql);

$sqlstmt->execute(); 

$sqlstmt->bind_result($dbCourseId, $dbCourseName);

$courses = array(); // easier if you don't use generic names for data 

$courseHTML = "";  
$courseHTML .= '<select name="courses" id="coursesDrop">'.PHP_EOL; 
$courseHTML .= '<option value="">Please Select</option>'.PHP_EOL;  

while($sqlstmt->fetch()) 
{ 
$course = $dbCourseId;
$coursename = $dbCourseName; 
$courseHTML .= "<option value='".$course."'>" . $course . " - " . $coursename . "</option>".PHP_EOL;  
} 

$courseHTML .= '</select>'; 
$courseHTML .= '</form>'; 

?>

<h1>CREATING A NEW ASSESSMENT</h1>

<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<table>
<tr>
<th>Course: <?php echo $courseHTML; ?><input id="courseSubmit" type="submit" value="Submit" name="submit" /></th>
</tr>
</table>
</form>

<?php
if (isset($_POST['submit'])) {

$submittedCourseId = $_POST['courses'];

$query = "
SELECT cm.CourseId, cm.ModuleId, 
c.CourseName,
m.ModuleName
FROM Course c
INNER JOIN Course_Module cm ON c.CourseId = cm.CourseId
JOIN Module m ON cm.ModuleId = m.ModuleId
WHERE
(c.CourseId = ?)
ORDER BY c.CourseName, m.ModuleId
";

$qrystmt=$mysqli->prepare($query);
// You only need to call bind_param once
$qrystmt->bind_param("s",$submittedCourseId);
// get result and assign variables (prefix with db)

$qrystmt->execute(); 

$qrystmt->bind_result($dbCourseId,$dbModuleId,$dbCourseName,$dbModuleName);

$qrystmt->store_result();

$num = $qrystmt->num_rows();

if($num ==0){
echo "<p style='color: red'>Please Select a Course</p>";
} else { 

echo "<p style='color: green'>Course Found '$courseid'</p>";

}

But this is the strange thing, the drop down menu works in Chrome, Firefox and Safari but not in Opera and IE. My question then is that is there something in the second block of code which is stopping it from working in IE or Opera?

  • 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-13T12:48:24+00:00Added an answer on June 13, 2026 at 12:48 pm

    Remove $courseHTML .= '</form>';, It’ll work.

    The fact is when you are adding </form> to $coureseHTML and adding this in side a form. The form closing tag finishes the form. And the rest of the code does not belong to the form. Here, <input id="courseSubmit" type="submit" value="Submit" name="submit" /> does not belong to preceding form. So clicking this button wont work. It should not work in any browser. May be its working on chrome, firefox and safari by luck.

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

Sidebar

Related Questions

I have something like the code below: for(int i=0;i<10;i++){ button=new JButton(buttons[i]); button.addActionListener(new ActionListener(){ public
I have something strange going on with some of my repos .. Xcode seems
I have something strange in my app. If in the ressources I have 2
I just noticed something strange. If I have this XML: <level number=7 background=background_5> and
I realize it's probably something strange, but here is what I have. I have
When saving a new entity something strange happens... I have a data grid with
I have just come across something that is quite strange and yet I haven't
I have something I am trying to achieve. I have a web application running
Something very strange is going on with a custom view containing a TextView .
I'm trying to figure something that is going on with my Route-Me code using

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.