Mr.Canuck Posted October 7, 2009 Share Posted October 7, 2009 Hello. Everything is working except for the re-direct. When I take out the HTML, the re-direct works fine. I think it has something to do with the fact that the first line of PHP is not on line 1 (I remember reading somewhere that white space can mess up PHP). I am trying to re-direct to: function redirect_to() { header("Location: http://cinematiccorp.com/step2.html"); }, but it keeps re-directing back to the same page. It works properly when I take out the HTML (so it is something to do with that). I probably just have it set up wrong. Any help would be appreciated. Below is the start of the code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta name="description" content="Lead generation to bring in more clients" /> <meta name="keywords" content="cinematics, videos, photos, multimedia, video creation, create video, lead generation, generate leads" /> <title>Cinematic Corporation</title> <link href="cinematic.css" rel="stylesheet" type="text/css" /> <!--[if IE 6]> <script type="text/javascript" src="unitpngfix.js"></script> <link href="cinematicIE6.css" rel="stylesheet" type="text/css" /> <![endif]--> <!--[if IE 7]> <link href="cinematicIE.css" rel="stylesheet" type="text/css" /> <![endif]--> </head> <body> <div id="container2"> <div id="header2"> <h1>"Take your photos and videos to the next level"</h1> <div id="body3"> <div id="backbutton2"><FORM><INPUT TYPE="button" VALUE="<--Back" onClick="history.go(-1);return true;"> </FORM></div> <h2 class="important">*Important*</h2> <p class="step1text">The maximum image size for each upload is 2MB. You may upload a maximum of 12 images. You also have an option to include text in your movie. Just write your desired text in the "text for movie" box at the bottom of the form. We will incorporate this into your movie. <span>TEXT LIMITATION</span> - You may request a total of 10 lines of text. You may choose 5 lines of text that are a maximum of 22 characters long each. You may then choose 5 more lines of text that are a maximum of 30 characters long. **NOTE: spaces and puntuation count as a character** See an example video with text HERE: <a href="sample-video.html">http://cinematiccorp.com/sample-video.html</a> Once we receive your photos and text (text is optional), we will create a spectacular video and blast it out to OVER 160 Networks! We will then send your video to the e-mail address that you included when filling out the form. The email will contain instructions on how to download your movie to your computer.</p> <?php error_reporting(0); foreach($_POST as $key => $value){ if (is_array($value)) { $_values[$key] = join("%,% ",$value); }else $_values[$key] = $value; $_values[$key]=stripslashes($_values[$key]); } if (!isset($_POST["_referer"])) { @$_referer = $_SERVER["HTTP_REFERER"]; }else $_referer = $_POST["_referer"]; $_ErrorList = array(); function mark_if_error($_field_name, $_old_style = ""){ global $_ErrorList; $flag=false; foreach($_ErrorList as $_error_item_name){ if ($_error_item_name==$_field_name) { $flag=true; } } echo $flag ? "style=\"background-color: #FFCCBA; border: solid 1px #D63301;\"" : $_old_style; } Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 7, 2009 Share Posted October 7, 2009 Do your logic (i.e. PHP) first - THEN do your output. So, put all your PHP at the top if the page. For any output that the PHP generates, save it to appropriate variables and output those variables within the HTML output. Unorganized way <html> <body> Today is a <?php $dow = date("l"); if($dow=='Saturday' ||$dow=='Sunday') echo "weekend."; } else { echo "workday."; } ?> </body> </html> Better way <?php $dow = date("l"); if($dow=='Saturday' ||$dow=='Sunday') $dayType = "weekend."; } else { $dayType = "workday."; } ?> <html> <body> Today is a <?php echo $dayType; ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
Mr.Canuck Posted October 7, 2009 Author Share Posted October 7, 2009 You sir, are exactly right! Thanks for the help. The re-direct is now working. 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.