Friday, March 10, 2017

storing data with action method in php

Here I have two pages . In first page i have a form for input id and i want to that id in database by action page. there are many field in sql part but this field show me vacant. i am trying but i could not find reason. here is my code.

  /////// My input page //////////
 <form method="post" action="p2.php">
   <input class="form-control input-sm" name="ID" id="inputsm" 

type="text" value="" style="width: 280px;height: 40px;" required><br>
<button type="submit">Enter</button>
 </form>
////// My action page //////////
$id=$_POST['ID'];
if (isset($_POST["sub"])) {
$query2= "INSERT INTO course_reg (stu_id,course_id,section,semester,grade,status) VALUES ('$id','$course_nm','$sec','Summer 2016','Z','a')";
$reg=mysqli_query($con,$query2);



via Mithun

Advertisement