I have a site that helps students make schedule's by inputting their classes. When they click a button, they can select the course from a dropdown and enter the class # in a box to the right. I am trying to use php to get the contents of the box, but it's not working. Part of the problem may be that the id
of the box is assigned a number (like 1, 2, 3) by javascript.
Here's the JSFIDDLE (only add 1 class, I haven't worked on adding 2 classes yet. ALSO the first number (like 100) is from the dropdown.)
HTML:
<form action='http://people.brandeis.edu/~rnewman/schedule.php' method='POST'>
<div id="boxes"></div>
<br>
<input type='button' value='Add Class' id='add' style='height: 40px;'>
<input type='submit' style='height: 40px;' value='Create Schedule'>
</form>
JQUERY:
var x = 0;
$(document).ready(function(){
$("#add").click(function(){
$('#boxes').append('<input type="text" id="' + ++x + '"><br>'); //the id isn't working
});
});
FROM schedule.php
echo $_POST['course'];
echo "<br>";
echo $_POST['0'];
echo $_POST['1'];
echo $_POST['2'];