Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am new to PHP and am having trouble getting data from the form to my second page.
None of these seem to work:
$course = $_REQUEST['course$i']
$course = $_REQUEST['course']
$course = $_REQUEST["course$i"]
$course = $_REQUEST["course"]
What am I doing wrong?Code: Select all
<html>
<head>
<title>Semester GPA Calculator</title>
<style type='text/css'>
th {text-align: left;}
</style>
</head>
<body>
<h2>Semester GPA Calculator</h2>
<p>Please enter your course information:</p>
<form action='script_semesterGPAT.php' method='post'>
<table width='50%'>
<tr><th>Course</th><th>Units</th><th>Letter Grade</th></tr>
<?php
for ($i=0; $i<5; $i+=1) {
print "<tr>\n";
print "\t<td><input type='text' name='course$i'></td>\n";
print "\t<td><input type='text' name='units$i' size=5></td>\n";
print "\t<td><input type='text' name='letterGrade$i' size=5></td>\n";
print "</tr>\n";
}
?>
</table>
<input type='submit' value='Calculate GPA'>
</form>
</body>
</html>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]