heshan Posted March 20, 2012 Share Posted March 20, 2012 I have following error when i try to enter my student info into the database. ! ) Warning: Header may not contain more than a single header, new line detected. in C:\wamp\www\Student registration\new student registration\newStudentRegistrationFormvalidation.php on line 43 newStudentRegistrationFormvalidation.php <?php $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initial=$_POST['name_with_initial']; $date_of_birth=$_POST['date_of_birth']; $religion=$_POST['religion']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $grade_ID=$_POST['grade_ID']; $stream_ID=isset($_POST['stream_ID']) ? $_POST['stream_ID'] :''; $class_ID=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $currentdate=getdate(time()); $year=$currentdate["year"]; //admission number validation $answer=''; $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); $query="SELECT admission_no FROM student_info WHERE student_info.admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $answer=$row['admission_no'];} if($answer==0) { //line 43 header("location:student registrationDatabase.php?admission_no=".$admission_no."&year=".$year."&admission_date=".$admission_date."&full_name=".$full_name."&name_with_initial=".$name_with_initial."&date_of_birth=".$date_of_birth."&religion=".$religion."&address=".$address."&telephone=".$telephone."&grade_on_admission=".$grade_on_admission."&grade_ID=".$grade_ID."&stream_ID=".$stream_ID."&class_ID=".$class_ID."&student_house=".$student_house."&password=".$password."&description_about_st=".$description_about_st."&payment=".$payment); exit(); }else{ ?> <body> <?php echo "Admission number".$admission_no."This student has been alredy entered to the system ."."<BR>"."<BR>"."<BR>"; echo "<a href='newStudentRegistrationForm.php'>GO to manage student details page</a> "; exit(); }?> studentregistrationDatabase.php <?PHP $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initials=$_POST['name_with_initial']; $dob=$_POST['date_of_birth']; $religion=$_POST['religion']; //$gender=$_GET['gender']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $present_grade=$_POST['grade_ID']; $stream=$_POST['stream_ID']; $present_class=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $current=getdate(time()); $year=$current["year"]; $today = date("Y-m-d"); $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); //insert to database $query="select count(*) from student_info where admission_no='$admission_no'"; $result=mysql_query($query); $row=mysql_fetch_array($result); if($row[0]==0) { $query="insert into student_info values(null,'$admission_no','$admission_date','$full_name','$name_with_initials','$dob','$religion','$address','$telephone','$grade_on_admission','$password','$student_house','$description_about_st')"; $result=mysql_query($query); if($stream!=null){ $query="select class_id from class where class.grade_id='$present_grade' and class.class_name='$present_class' and class.stream='$stream'"; }else{ $query="select class_id from class where class.grade_id='$present_grade' and class.class_name='$present_class'"; } $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $class_id=$row['class_id']; } $query="insert into student_class values('$admission_no','$class_id','$year')"; $result=mysql_query($query); if($payment=="2000") { $query="insert into payment_amount values(null,'2000','$today')"; $result=mysql_query($query); $query="SELECT amount_id FROM payment_amount order by amount_id DESC limit 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { $amount_id=$row['amount_id']; } $query="insert into payment values('$admission_no','$amount_id')"; $result=mysql_query($query); }else{ $query="insert into payment_amount values(null,'0','$today')"; $result=mysql_query($query); $query="SELECT amount_id FROM payment_amount order by amount_id DESC limit 1"; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { $amount_id=$row['amount_id']; } $query="insert into payment values('$admission_no','$amount_id')"; $result=mysql_query($query); } header("location:../new student registration-parent details/studentRegistrationParentDetailsForm.php?admission_no=".$admission_no); exit(); } else{ ?> <?php echo "Admission number".$admission_no."This student has been already entered to the system"."<BR>"."<BR>"."<BR>"; echo "<a href='student registration.php'>GO to registration page</a>"; exit(); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/ Share on other sites More sharing options...
seanlim Posted March 20, 2012 Share Posted March 20, 2012 One of your variables used in the header function has a newline character. It's probably a good idea to run all your variables through urlencode before adding them to the url anyway, that should prevent the error. Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329305 Share on other sites More sharing options...
heshan Posted March 21, 2012 Author Share Posted March 21, 2012 Dear seanlim, I didn't get you..Could you pls show me the error in my code? Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329721 Share on other sites More sharing options...
dragon_sa Posted March 21, 2012 Share Posted March 21, 2012 you have a space between student and registrationDatabase.php in the header location, which is causing your error the page should be one word change line 43 to this header("location: studentregistrationDatabase.php?admission_no=".$admission_no."&year=".$year."&admission_date=".$admission_date."&full_name=".$full_name."&name_with_initial=".$name_with_initial."&date_of_birth=".$date_of_birth."&religion=".$religion."&address=".$address."&telephone=".$telephone."&grade_on_admission=".$grade_on_admission."&grade_ID=".$grade_ID."&stream_ID=".$stream_ID."&class_ID=".$class_ID."&student_house=".$student_house."&password=".$password."&description_about_st=".$description_about_st."&payment=".$payment); Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329722 Share on other sites More sharing options...
litebearer Posted March 21, 2012 Share Posted March 21, 2012 check ALL the headers - spaces in at least 2 of them Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329723 Share on other sites More sharing options...
dragon_sa Posted March 21, 2012 Share Posted March 21, 2012 your also going to have the same problem on studentregistrationDatabase.php, where you have done the same thing and have created a header location to a page with spaces in the name, you cant do this. header("location:../new student registration-parent details/studentRegistrationParentDetailsForm.php?admission_no=".$admission_no); you need to delete the spaces or use _ or - to join your words and rename your file and folders the same way Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329724 Share on other sites More sharing options...
heshan Posted March 21, 2012 Author Share Posted March 21, 2012 Hi all, Thanks all for your suggestions. But i checked my folders and PHP files. They were saved with a space in the folder. (student registrationDatabase.php) Anyway i removed the spaces and recheck once again. But the same error displayed...... Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329832 Share on other sites More sharing options...
dragon_sa Posted March 21, 2012 Share Posted March 21, 2012 can you post the error you have now and also the code you have now, and please use the code tags to insert you code here by clicking on the # button when posting, put any code inside the 2 tags it adds for you Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329838 Share on other sites More sharing options...
Muddy_Funster Posted March 21, 2012 Share Posted March 21, 2012 my money is on $description_about_st=$_POST['description_about_st']; being the problem. I suspect this is a textarea. Is this the case? Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329843 Share on other sites More sharing options...
seanlim Posted March 21, 2012 Share Posted March 21, 2012 you probably have one or more invalid characters in your header("location: ..."); maybe try urlencode, you probably want to pass all your fields through that function before adding them to the URL, i.e. header("Location: blahblah.php?field1=".urlencode($field1)); Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329861 Share on other sites More sharing options...
heshan Posted March 21, 2012 Author Share Posted March 21, 2012 Here is the coding. newStudentRegistrationFormValidation.php NOTE : student registrationDatabase.php file is saved with a space <?php $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initial=$_POST['name_with_initial']; $date_of_birth=$_POST['date_of_birth']; $religion=$_POST['religion']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $grade_ID=$_POST['grade_ID']; $stream_ID=isset($_POST['stream_ID']) ? $_POST['stream_ID'] :''; $class_ID=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $currentdate=getdate(time()); $year=$currentdate["year"]; //admission number validation $answer=''; $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); $query="SELECT admission_no FROM student_info WHERE student_info.admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $answer=$row['admission_no'];} if($answer==0) { header("location:[b]student registrationDatabase.php[/b]?admission_no=".$admission_no."&year=".$year."&admission_date=".$admission_date."&full_name=".$full_name."&name_with_initial=".$name_with_initial."&date_of_birth=".$date_of_birth."&religion=".$religion."&address=".$address."&telephone=".$telephone."&grade_on_admission=".$grade_on_admission."&grade_ID=".$grade_ID."&stream_ID=".$stream_ID."&class_ID=".$class_ID."&student_house=".$student_house."&password=".$password."&description_about_st=".$description_about_st."&payment=".$payment); exit(); }else{ ?> <body> <?php echo "Admission number".$admission_no."This student has been alredy entered to the system ."."<BR>"."<BR>"."<BR>"; echo "<a href='newStudentRegistrationForm.php'>GO to manage student details page</a> "; exit(); }?> The error is : ! ) Warning: Header may not contain more than a single header, new line detected. in C:\wamp\www\Student registration\new student registration\newStudentRegistrationFormvalidation.php on line 43 Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1329935 Share on other sites More sharing options...
dragon_sa Posted March 21, 2012 Share Posted March 21, 2012 You missed the point, on a webserver you cannot have filenames with spaces in them. This is breaking your code. On a windows computer you can save file names with spaces, but you can not use those files on a webserver, the spaces need to be deleted or replaced with a _ or - The file redirected to in the header command cannot have any spaces, as soon as it gets to a space it stops and thinks that is the file you want to go to, then it sees the information after the space and thinks you have specified 2 files and throws the error. Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330037 Share on other sites More sharing options...
heshan Posted March 22, 2012 Author Share Posted March 22, 2012 Hi dragon_sa, I have rename my php file as studentregistrationDatabase.php and also delete the space in my header location. Thereafter also same error displayed. What can i do now? Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330119 Share on other sites More sharing options...
dragon_sa Posted March 22, 2012 Share Posted March 22, 2012 can you post exactly what code you have now? Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330120 Share on other sites More sharing options...
heshan Posted March 22, 2012 Author Share Posted March 22, 2012 Here is it.. <?php $admission_no=$_POST['admission_no']; $admission_date=$_POST['admission_date']; $full_name=$_POST['full_name']; $name_with_initial=$_POST['name_with_initial']; $date_of_birth=$_POST['date_of_birth']; $religion=$_POST['religion']; $address=$_POST['address']; $telephone=$_POST['telephone']; $grade_on_admission=$_POST['grade_on_admission']; $grade_ID=$_POST['grade_ID']; $stream_ID=isset($_POST['stream_ID']) ? $_POST['stream_ID'] :''; $class_ID=$_POST['class_ID']; $student_house=$_POST['student_house']; $password=$_POST['password']; $description_about_st=$_POST['description_about_st']; $payment=$_POST["payment"]; $currentdate=getdate(time()); $year=$currentdate["year"]; //admission number validation $answer=''; $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); $query="SELECT admission_no FROM student_info WHERE student_info.admission_no='$admission_no'"; $result=mysql_query($query); while($row=mysql_fetch_array($result)){ $answer=$row['admission_no'];} if($answer==0) { header("location:studentregistrationDatabase.php?admission_no=".$admission_no."&year=".$year."&admission_date=".$admission_date."&full_name=".$full_name."&name_with_initial=".$name_with_initial."&date_of_birth=".$date_of_birth."&religion=".$religion."&address=".$address."&telephone=".$telephone."&grade_on_admission=".$grade_on_admission."&grade_ID=".$grade_ID."&stream_ID=".$stream_ID."&class_ID=".$class_ID."&student_house=".$student_house."&password=".$password."&description_about_st=".$description_about_st."&payment=".$payment); exit(); }else{ ?> <body> <?php echo "Admission number".$admission_no."This student has been alredy entered to the system ."."<BR>"."<BR>"."<BR>"; echo "<a href='newStudentRegistrationForm.php'>GO to manage student details page</a> "; exit(); }?> Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330121 Share on other sites More sharing options...
Muddy_Funster Posted March 22, 2012 Share Posted March 22, 2012 jeezus, do I whisper or something? Post up your form please. Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330124 Share on other sites More sharing options...
heshan Posted March 22, 2012 Author Share Posted March 22, 2012 Here is it. form name="form1" method="post" action="newStudentRegistrationFormvalidation.php"> <?PHP $con=mysql_connect("localhost","root",""); mysql_select_db("student_management",$con); ?> <table width="850" border="1" align="center"> <tr> <td colspan="2"><table width="100%" cellpadding="0" cellspacing="0"> <tr> <td width="25%"><img src="IMAGE/logo.png" width="200" height="200" /></td> <td width="75%" align="center" valign="middle"><div align="center"><img src="IMAGE/name.png" width="491" height="88" /></div></td> </tr> </table></td> </tr> <tr> <td width="170"> </td> <td width="664"><table width="600" border="0"> <tr> <td width="124"> </td> <td width="124"> </td> <td width="124"> </td> <td width="124" align="center"><a href="../../add admin users/changePasword.php">Change Password</a></td> <td width="129" align="center"><a href="../../Home page/new student registration/signout.php">Signout</a></td> </tr> </table></td> </tr> <tr> <td height="59" valign="top"><table width="170" border="1" bordercolor="#000000"> <tr> <td width="162"><a href="../../add admin users/add techer/addAdminUser.php"> <label>Add Admin Login</label> </a></td> </tr> <tr> <td><a href="../../add admin users/manage teacher/searchAdminUser.php"> <label>Manage Addmin Login</label> </a></td> </tr> <tr> <td bgcolor="#CCCCCC"><label>Add Student</label> </td> </tr> <tr> <td><a href="../manage student details/manageStudentDetails.php"> <label>Manage Student</label> </a></td> </tr> <tr> <td><a href="../../student attendance/add attendance/addStudentAttendance.php"> <label>Add Student Attendance </label> </a></td> </tr> <tr> <td><a href="../../student attendance/manage attendance/manageStudentAttendance.php"> <label>Manage Student Attendance </label> </a></td> </tr> <tr> <td><a href="../../Student time table/add1 time table/addTimeTable.php"> <label>Add Time Table</label> </a></td> </tr> <tr> <td><a href="../../Student time table/maange time table/manageTimeTable.php"> <label>Manage Time Table</label> </a></td> </tr> <tr> <td><a href="../../Student marks/add student marks/addStudentMark.php"> <label>Add Student Marks</label> </a></td> </tr> <tr> <td><a href="../../Student marks/manage stdent marks/manageStudentMark.php"> <label>Manage Student Marks</label> </a></td> </tr> <tr> <td><a href="../../manage subject/add subject.php"> <label>Add Subject</label> </a></td> </tr> <tr> <td><a href="../../manage subject/manage subject.php"> <label>Manage Subject</label> </a></td> </tr> <tr> <td><a href="../../search student information/SearchStudentInformation.php"> <label>Search Student Information</label> </a></td> </tr> <tr> <td><a href="../../manage students grade/manage student grade.php"> <label>Manage Student Grade</label> </a></td> </tr> <tr> <td><a href="../../manage student class/manageStudentClass.php"> <label>Manage Student Class</label> </a></td> </tr> <tr> <td><a href="../../manage student payment/manageStudentsPayments.php"> <label>Manage Student Payment</label> </a></td> </tr> <tr> <td><a href="../../home management/home management.php"> <label>Manage Home Page</label> </a></td> </tr> <tr> <td><a href="../../student payments reports/studentsPayments.php"> <label>Student Payment Reports</label> </a></td> </tr> <tr> <td><a href="../../Issue certificate/issueCertificate.php"> <label>Issue Certificate</label> </a></td> </tr> </table></td> <td><table width="633" border="0"> <tr> <td> </td> <td colspan="5"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td width="9"> </td> <td colspan="5"><h3> <label><strong>Add Student Information</strong></label> <strong> </strong></h3></td> <td width="13"> </td> <td width="19"> </td> <td width="51"> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td colspan="3"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td colspan="3"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Admission Number </label> </td> <td colspan="3"> <input type="text" name="admission_no" id="textfield" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Admission Date</label> </td> <td colspan="5"> <input type="text" name="admission_date" id="admission_date" /><a href="javascript:NewCssCal('admission_date','yyyymmdd')"> <img src="images/cal.gif"alt="Pick a date" width="16" height="16" border="0"></a> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Student Full Name </label> </td> <td colspan="3"> <textarea name="full_name" id="textfield2"></textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Student Name With Initials </label> </td> <td colspan="3"> <input type="text" name="name_with_initial" id="textfield3" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Date of Birth </label> </td> <td colspan="3"><input type="text" name="date_of_birth" id="date_of_birth" /><a href="javascript:NewCssCal('date_of_birth','yyyymmdd')"> <img src="images/cal.gif"alt="Pick a date" width="16" height="16" border="0"></a></td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Religion </label> </td> <td colspan="3"><label> <select name="religion" id="select2"> <option selected="selected"></option> <option>Buddhism</option> <option>Cathelic</option> <option>Roman Cathelic</option> <option>Muslim</option> <option>Hindu</option> <option>Other</option> </select> </label></td> <td> </td> <td> </td> <td> </td> </tr> <tr> </tr> <tr> <td> </td> <td colspan="2"><label>Address </label> </td> <td colspan="3"> <textarea name="address" id="textarea" cols="45" rows="5"></textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Telephone Number </label> </td> <td colspan="3"> <input type="text" name="telephone" id="textfield6" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Grade on Admission </label> </td> <td colspan="3"> <select name="grade_on_admission" id="jumpMenu" > <?PHP $query="SELECT * FROM grade "; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['grade_id']."\">".$row['grade']."</option> \n "; } ?> </select> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Present Grade</label> </td> <td width="113"> <select name="grade_ID" id="jumpMenu2" onchange="changestream()" > <?php $query="SELECT * FROM grade "; $result=mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['grade_id']."\">".$row['grade']."</option> \n "; } ?> </select> </td> <td width="59"><label>Stream</label> </td> <td> <select name="stream_ID" id="jumpMenu4" disabled="disabled"> <option selected="selected"></option> <option>Maths</option> <option>Science</option> <option>Commerce</option> <option>Art</option> </select> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Present Class</label> </td> <td colspan="3"> <select name="class_ID" id="jumpMenu3" > <option selected="selected"></option> <option>A</option> <option>B</option> <option>C</option> <option>D</option> <option>E</option> <option>F</option> <option>G</option> <option>H</option> <option>I</option> <option>J</option> <option>K</option> <option>L</option> <option>M</option> <option>N</option> <option>O</option> <option>P</option> <option>Q</option> <option>R</option> <option>S</option> <option>T</option> <option>U</option> <option>V</option> <option>W</option> <option>X</option> <option>Y</option> <option>Z</option> </select> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Student House</label> </td> <td colspan="3"> <select name="student_house" id="select"> <option selected="selected"></option> <option>PARAVI</option> <option>HANSA</option> <option>GIRA</option> <option>KOKILA</option> </select> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>School payments</label> </td> <td colspan="3"> <input type="radio" name="payment" id="radio3" value="2000" /> yes <input type="radio" name="payment" id="radio4" value="0" checked="checked"/> no </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Password</label> </td> <td colspan="3"> <input type="password" name="password" id="textfield8" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Confirm Password</label></td> <td colspan="3"> <input type="password" name="ConfirmPassword" id="textfield9" /> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"><label>Student Description</label> </td> <td colspan="3"> <textarea name="description_about_st" id="textarea2" cols="45" rows="5"> </textarea> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td colspan="3"> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td colspan="3"> <input type="submit" name="button3" id="button3" value="Save" onClick="return Validate();"/> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> <td colspan="3"> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <p> </p> <p> </p></td> </tr> </table> </form> Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330131 Share on other sites More sharing options...
Muddy_Funster Posted March 22, 2012 Share Posted March 22, 2012 yeah, as I thought, because <textarea></textarea> allows for carrage returns, you are pushing these into your header. These are then being processed and your header sting is being built with new line breaks (\r\n), hence the error. You will need to use urlencode() to pass the header. eg: <?php $m = "my string is over\r\nmultiple lines"; $u = urlencode($m); echo "$m<br><br>$u" ?> Will return: my string is over multiple lines my+string+is+over%0D%0Amultiple+lines You see the %0D%0A in second line? this lets the information pass through the url without breaking it. You need to apply urlencode() to your header string for it to work...which in all fairness seanlim already told you. On another note, there has to be a better way to achieve what you are doing (like only sending the relevent ID in the url and performing the lookup for the rest once you're on the recieving page, or learning how to use session variables) Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330138 Share on other sites More sharing options...
heshan Posted March 22, 2012 Author Share Posted March 22, 2012 Thanks everyone.....got the point... Quote Link to comment https://forums.phpfreaks.com/topic/259316-error-displayed-in-my-query/#findComment-1330171 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.