buggy
01-25-2010, 08:19 PM
If input is submited blank an error msg comes up but only half the page shows:
<!-- Top html -->
<?php
// Check if the user submitted this form
if($_POST['submit'])
{
// Change HTML code so hackers cant f*ck you over eg: < to <
$_POST['input'] = htmlspecialchars($_POST['input']);
// Check if input field is blank
if (empty($_POST['input'])) {
die('Error msg!');
}
// Open the file in write mode
$handle = fopen("inc/$list","a");
// If successful
if ($handle) {
// Write to that handle the input submitted
fwrite($handle, $_POST['input'] . PHP_EOL);
// Close
fclose($handle);
}
?>
<p><?php echo $success;?></p>
<?php
}
else
{
?>
<!-- Form is here -->
<?php
}
?>
<!-- Bottom html -->
it stops at the end of error msg so Bottom half of the html is missing ...
<!-- Top html -->
<?php
// Check if the user submitted this form
if($_POST['submit'])
{
// Change HTML code so hackers cant f*ck you over eg: < to <
$_POST['input'] = htmlspecialchars($_POST['input']);
// Check if input field is blank
if (empty($_POST['input'])) {
die('Error msg!');
}
// Open the file in write mode
$handle = fopen("inc/$list","a");
// If successful
if ($handle) {
// Write to that handle the input submitted
fwrite($handle, $_POST['input'] . PHP_EOL);
// Close
fclose($handle);
}
?>
<p><?php echo $success;?></p>
<?php
}
else
{
?>
<!-- Form is here -->
<?php
}
?>
<!-- Bottom html -->
it stops at the end of error msg so Bottom half of the html is missing ...