Dethman Posted August 6, 2008 Share Posted August 6, 2008 Hello all, I am making an admins panel and my code keeps throwing my SQL var into the header here is the admin.php page: <?php //SET REQUIRES! require("db_connect.php"); require("functions/admin-functions.php"); //GET PAGE! $page=$_GET['page']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>{SAP} :: Bringing Website Maintinace on your own terms!</title> <link href="styles.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- header --> <div id="header"> <div id="menu"> <div id="menu_list"> <?php if(isset($_SESSION['id'])){?> <a href='admin.php'>Home</a> <img src='images/splitter.gif' class='splitter' alt='' /> <a href='admin.php?page=add'>Add Page</a> <img src='images/splitter.gif' class='splitter' alt='' /> <a href='admin.php?page=edit'>Edit Pages</a> <img src='images/splitter.gif' class='splitter' alt='' /> <a href='admin.php?page=help'>Help</a> <img src='images/splitter.gif' class='splitter' alt='' /> <?}else{ }?> </div> </div> </div> <div id="logo"> <div id="logo_text"> <a href="#"><?echo($row['Company']);?></a> <br/><br/> <?echo($row['Type']);?> </div> </div> <!--end header --> <!-- main --> <div id="main"> <div id="text" > <font color="red"><?echo $_GET['strErr'];?></font> <?php function main(){ if(isset($_SESSION['id'])){ include("lib_html/main.php"); } else{ include("lib_html/login.php"); } } switch($page){ case "help": include("lib_html/help.php"); break; case "add": include("lib_html/add.php"); break; case "edit": include("lib_html/edit.php"); break; default: main(); break; } ?> </div> </div> <!-- end main --> <!-- footer --> <div id="footer"> <div id="left_footer">© Copyright 2008 <b><?echo($row['Company']);?></b></div> <div id="right_footer"> <!-- Please do not change or delete this link. Read the license! Thanks. :-) --> </div> </div> <!-- end footer --> </body> </html> Here is my add.php: <?php IF( ISSET($_POST['Submit']) ){ $NAME=$_POST['name']; $COMPANY=$_POST['COMPNAME']; $SEQUENCE=$_POST['sequence']; $PAGE_INFO=$_POST['INFO']; IF( EMPTY($NAME) ){ $MESSAGE=("PAGE NAME WAS LEFT BLANK PLEASE FILL IT IN BEFORE MOVING ON"); } ELSE IF( EMPTY($COMPANY) ){ $MESSAGE=("COMPANY NAME FOR PAGE WAS LEFT BLANK PLEASE FILL IT IN BEFORE MOVING ON"); } ELSE IF( EMPTY($SEQUENCE) ){ $MESSAGE=("SEQUENCE FOR PAGE WAS LEFT BLANK PLEASE FILL IT IN BEFORE MOVING ON"); } ELSE IF( EMPTY($PAGE_INFO) ){ $MESSAGE=("PAGE INFO WAS LEFT BLANK PLEASE FILL IT IN BEFORE MOVING ON"); }ELSE{ $SQL="INSERT INTO `page` SET `Name` ='$NAME', `Company` ='$COMPANY', `Sequence` ='$SEQUENCE', `pageInfo` ='$PAGE_INFO'"; $Result=mysql_query($SQL); IF( $Result ){ $MESSAGE=("PAGE ADDED!"); } ELSE{ header("LOCATION: admin.php?strErr=".mysql_error().""); } } } ?> <form action='admin.php?page=add' name='form1'> <font color='red'><?echo($MESSAGE);?></font><br> <h1>Add a Page</h1><br> Page Name: <INPUT NAME=name value="Test Page" maxlength=24 size="24"><br> Company Name: <INPUT TYPE=text NAME=COMPNAME value="Company Name" size="20"><br> Page Sequence: <input type='text' size=20 name='sequence' maxlength=24 value='1'><br> Page Info:<br> <valign=right><textarea name="INFO" cols="71.5" rows="20" id="info"><h2>Posted By: <b>Brian Flores</b></h2> <br> <h1>This is a test Header</h1<br> <p>This is a test paragraph showing what the page should and will look like. Here you can see what exactly the webpage/entrire page will look like. Right now I can not think of anything else to type so I am just gana wright random stuff. Marry Had a Little Lamp Light was yellow as something yelllow </p> <br> <h1>Test Header Number 2</h1> <p>As I said I am gana keep wrighting random crap untill I get tired of my hands freeze up of carpol tunnel, grr I feal it comming on :S well what can I say I put 6hours a day into this programmed website and doing it that much hurts my hand. well enouph with that crap I am a white male red head looking for two hot blonde/brunette chicks to... well Brian Out! </p></textarea><br> <center><INPUT STYLE="WIDTH: 50px" TYPE=submit VALUE=Submit Name="Submit"></center> </form> as you can see my $SQL var is getting thrown into the Browser header here is what it looks like: http://localhost/admin/admin.php?name=Test+Page&COMPNAME=Company+Name&sequence=1&INFO=%3Ch2%3EPosted+By%3A+%3Cb%3EBrian+Flores%3C%2Fb%3E%3C%2Fh2%3E+%0D%0A%3Cbr%3E%0D%0A%3Ch1%3EThis+is+a+test+Header%3C%2Fh1%3Cbr%3E%0D%0A%3Cp%3EThis+is+a+test+paragraph+showing+what+the+page+should+and+will+look+like.+Here+you+can+see+what+exactly+the+webpage%2Fentrire+page+will+look+like.+Right+now+I+can+not+think+of+anything+else+to+type+so+I+am+just+gana+wright+random+stuff.+Marry+Had+a+Little+Lamp+Light+was+yellow+as+something+yelllow+%3C%2Fp%3E%0D%0A%3Cbr%3E%0D%0A%3Ch1%3ETest+Header+Number+2%3C%2Fh1%3E%0D%0A%0D%0A%3Cp%3EAs+I+said+I+am+gana+keep+wrighting+random+crap+untill+I+get+tired+of+my+hands+freeze+up+of+carpol+tunnel%2C+grr+I+feal+it+comming+on+%3AS+well+what+can+I+say+I+put+6hours+a+day+into+this+programmed+website+and+doing+it+that+much+hurts+my+hand.+well+enouph+with+that+crap+I+am+a+white+male+red+head+looking+for+two+hot+blonde%2Fbrunette+chicks+to...%0D%0A%0D%0Awell+Brian+Out!%0D%0A%3C%2Fp%3E&Submit=Submit Can anyone help me out this is annoying, Thanks All for your help! Brian Flores C.E.O of Nimbusgames,llc Link to comment https://forums.phpfreaks.com/topic/118382-solved-for-some-reason-this-is-putting-my-sql-var-into-the-header-link-s/ Share on other sites More sharing options...
BioBob Posted August 6, 2008 Share Posted August 6, 2008 in your <FORM> tag, add in METHOD = "POST". If you dont have that in there, default is GET, so it appears in your link. Link to comment https://forums.phpfreaks.com/topic/118382-solved-for-some-reason-this-is-putting-my-sql-var-into-the-header-link-s/#findComment-609261 Share on other sites More sharing options...
Dethman Posted August 6, 2008 Author Share Posted August 6, 2008 Dang I can belive I forgot that thanx for the help am a bit tireds Link to comment https://forums.phpfreaks.com/topic/118382-solved-for-some-reason-this-is-putting-my-sql-var-into-the-header-link-s/#findComment-609273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.