×

Please Login or Register to continue.

3
(354 Views)

 It is working  but the subject and Choose, I want to place Combobox after RollNo & this is my code please check when I enter subject and rollno and obtained marks the result is not showing eg:- its shows roll no name obtained marks and not subject I send you my code please check

(90 Points)
in PHP

Share

1 Answer
(9.2K Points)
(edited)
0

I answered you. You have to simply change the code like this -

Change <form></form> code -
 

form></form> code - 

<form action="" method="post" name="form1">
        <table width="25%" border="0">
            <tr>
                <td>RollNo</td>
                <td><input type="number" min = 1  name="RollNo"></td>
            </tr>
<tr><td> 
<?php 
$cser=mysqli_connect("localhost","root","","test") or die("connection failed:".mysqli_error());
$result = mysqli_query($cser,"SELECT pname FROM crud2") or die(mysql_error());
if (mysqli_num_rows($result)!=0)
{
echo 'Subject Name : </td><td><select name="pname">
      <option value=" " selected="selected">Choose one</option>';
   while($drop_2 = mysqli_fetch_array( $result ))
{
  echo '<option value="'.$drop_2['pname'].'">'.$drop_2['pname'].'</option>';
}
echo '</select>';
}
?>
</td>
</tr> 
            <tr>
                <td>Name</td>
                <td><input type="text" pattern="[a-zA-Z][a-zA-Z ]{2,}"  name="Name"></td>
            </tr>
            <tr>
                <td>ObtainedMarks</td>
                <td><input type="number" min = 1 name="ObtainedMarks"></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" name="Submit" value="Enter"></td>
            </tr>
        </table>
    </form>

Change the PHP database name, column name.

This is form code.  Search form code inside the insert code and replace complete form code to this.


Comment
It works, Thank you.
osama 06 Sep 2019
Please do not ask the same questions. You can discuss in the comment. Change name to your table subject name. <select name="pname"> shlulbe be <select name="sujectcolumnname"> What is your column name for subject ?
shakti 06 Sep 2019
Welcome. You can ask any question. Follow the guidelines. 1. Ask unique questions. (Unlimited) 2. Do not ask the same question again. (Get solution on same question page no need to add another question base on the same question) Ask me another question. Best Regards - Shakti
shakti 06 Sep 2019
Okay Bro Thanks
osama 06 Sep 2019

Related Questions :-

Your Answer

You can post your answer after login..