I must 'exchange' data between files, so i created a HTML file called workout_calc_var.html
and this is it's contents:
Code: Select all
<HTML>
<HEAD>
<title>Submit</title>
</HEAD>
<BODY>
<TABLE BORDER="0" CELLPADDING="10" WIDTH="100%">
<TR>
<TD BGCOLOR=”#F0F8FF” ALIGN="CENTER" VALIGN="TOP" WIDTH="150">
</TD>
<TD BGCOLOR=”#FFFFFF” ALIGN="LEFT" VALIGN="TOP" WIDTH="83%">
<H1>Workout calculator (passing a variable)</H1>
<P>Enter an exercise, and we’ll tell you how long you’d have
to do it<BR />to burn one pound of fat.</P>
<FORM METHOD=”post” ACTION=”wc_handler_var.php”>
<INPUT TYPE=”text” SIZE="50" NAME=”exercise” />
<p><input type="submit" value="exercise"/></p>
</FORM>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Code: Select all
<?php
$exercise = $_POST[‘exercise’];
?>
<HTML>
<HEAD>
<STYLE TYPE=”text/css”>
<!--
BODY, P {color: black; font-family: verdana;
font-size: 10 pt}
H1 {color: black; font-family: arial; font-size: 12 pt}
-->
</STYLE>
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=10 WIDTH=100%>
<TR>
<TD BGCOLOR=”#F0F8FF” ALIGN=CENTER VALIGN=TOP WIDTH=150>
</TD>
<TD BGCOLOR=”#FFFFFF” ALIGN=LEFT VALIGN=TOP WIDTH=83%>
<H1>Workout calculator handler, part 1</H1>
<P>We’ve successfully passed the contents of the
text input field,<BR>
as a variable called “exercise” with a value of
<B><?php echo $exercise; ?></B>.<BR>
But before we can do anything interesting with it,
we need to learn about strings.</P>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
So, i open first HTML file with my web browser (http://localhost/2/workout_calc_var.html) and enter
a value and click on submit and get following error:
Not Found
The requested URL /2/â€wc_handler_var.php†was not found on this server.
Why is this? And when i run the other file nothing get's to it?
What im I doing wrong? Maybe it's simple but i'm a begginer in PHP so don't laugh much...
Thanks! Daniel!