PHP error-undefined variable?

Dom G

New member
I'm a rookie with PHP, but the course i am on, requires me to make a competition website for submitting a caption. However, i get this error when i try to submit the quote

Notice: Undefined variable: username in /Users/mymac/Sites/quotewrite.php on line 5

This is a section of the PHP

<?php
session_start();
$caption = $_POST['caption'];

$newsubmit = $username . "," . $caption . "\n";

$filename = 'captions.csv';

?>
And the HTML from the login page

<form method="post" action="login.php">

<p class="username">Username:<input type="text" name="username" size="25" maxlength="20">


>

I dont understand why, if i have defined the username on the logon screen and have signed in, and haven't closed the session, this error appears
 
Back
Top