ljackson Posted March 10, 2009 Report Share Posted March 10, 2009 (edited) Hi all, ok i have a webpage with a form on it which contains an image validator what i want to happen is if the validator is incorrect then a varible value is changed and displayed on the current page underneath the input box telling the user that they entered an incorrect code, and if they entered a correct code i want the page to redirect to the previous page before the rate.php page i am currently having trouble getting any message to appear when incorrectly entered and when its correctly entered i get Warning: Cannot modify header information - headers already sent by here is my rate.php code <?php session_start(); ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); require('functions.php'); require('_drawrating.php'); include_once('db101.php');?> Kernow Connect $message101=""; if( isset($_POST['submit'])) { if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) { // Insert you code for processing the form here, e.g emailing the submission, entering it into a database. $sql="UPDATE ratings SET used_ips = NULL, total_value = 0, total_votes = 0 WHERE id IN ('valuetemp', 'easeofusetemp', 'deliverytemp', 'delchargetemp')"; $query = mysql_query($sql); header('index.php'); unset($_SESSION['security_code']); } else { // Insert your code for showing an error message here $message101 ="Please enter the above code"; } } else { ?> //Database info included in include Toplinks(); print " "; ?> Value for moneyEase of useDelivery timeP&P costs Please Enter Security Code: any help is appreciated cheers Luke Edited March 30, 2009 by ljackson Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted March 10, 2009 Report Share Posted March 10, 2009 The issue is that you are outputting some html before the Header is written. Try moving the php if statement above the HTML code for the page, or use ob_start(). That should work. Quote Link to comment Share on other sites More sharing options...
ljackson Posted March 30, 2009 Author Report Share Posted March 30, 2009 thanks mate, all sorted now many thanks Luke Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.