This makes no sense
Posted: Thu Jan 15, 2009 1:33 pm
Okay I have this form:
logic/page.php looks like this:
Here is the problem. You see the print_r statement? When that statement is there, I can see that 'button' is set and the if statement returns true and the block of code is executed. Without the print_r statement, the if statement is false because 'button' doesn't exist and "fail" gets printed. This makes no sense at all.
Code: Select all
<form action="logic/page.php" method="post" accept-charset="utf-8"> <p>Title: <input type="text" name="title" value="<?=$data['title']?>" maxlength="<?=MAX_PAGE_TITLE_LENGTH?>" /></p> <p>Body:<br /> <textarea rows="15" cols="50" name="body"><?=$data['body']?></textarea> <p><input type="submit" name='button' value="Preview" /> <input type="submit" name='button' value="Continue →" /></p></form>Code: Select all
<?php
session_start();
define('IN_SITE', 1);
require_once '../includes/functions.php';
print_r($_POST);
if(isset($_POST["button"]) && $_POST["button"] == 'Preview')
{
setFormData($_POST);
header('Location: page.php?mode=add');
exit;
}
echo 'fail';