473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to remove newlines from header

37
I have a form with a textarea field.
Everything is ok until the user submitting the form adds returns characters.

When return characters are added I get this error

Warning: Header may not contain more than a single header, new line detected

This is the part of the script highlighted by the error message.

header('Location:' . $_action);
Nov 8 '11 #1
2 1977
johny10151981
1,059 1GB
use str_replace function
Nov 8 '11 #2
Max58kl
37
If I submit the form refrencing 'report_pubaccess' I get this vardump

Expand|Select|Wrap|Line Numbers
  1. getarray(2) {
  2.   ["pub_access"]=>
  3.   string(11) "laptop four"
  4.   ["report_pubaccess"]=>
  5.   string(7) "testing"
  6. }
If I asign report_pubaccess to a variable $report using string replace
and send the variable

Expand|Select|Wrap|Line Numbers
  1. $report = str_replace("\n", " ", trim($_GET['report_pubaccess'])); 
The variable is send however not the text

Expand|Select|Wrap|Line Numbers
  1. getarray(2) {
  2.   ["pub_access"]=>
  3.   string(10) "laptop one"
  4.   ["$report"]=>
  5.   string(1) "1"
  6. }
Variable version

Expand|Select|Wrap|Line Numbers
  1. $_def_soft_id = 1;
  2. $_def_id = 9876;
  3.  
  4.  $_soft_id = isset($_GET[$report]) ? $_GET[$report] : $_def_soft_id;
  5. $_id = isset($_GET['pub_access']) ? $_GET['pub_access'] : $_def_id;
  6.  
  7. $_action = 'report_confirm_pub.php?pub_access=' . $_id . '&$report=' . $_soft_id;
  8.  
  9. header('Location:' . $_action);

'report_pubaccess' version


Expand|Select|Wrap|Line Numbers
  1. $_def_soft_id = 1;
  2. $_def_id = 9876;
  3.  
  4.  $_soft_id = isset($_GET['report_pubaccess']) ? $_GET['report_pubaccess'] : $_def_soft_id;
  5. $_id = isset($_GET['pub_access']) ? $_GET['pub_access'] : $_def_id;
  6.  
  7. $_action = 'report_confirm_pub.php?pub_access=' . $_id . '&report_pubaccess=' . $_soft_id;
  8.  
  9. header('Location:' . $_action);
Nov 8 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Nullstyle | last post by:
Hi there guys. I need a little advice on how to create C++ header files using the Borland C++ 5.5.1 compiler. Thanks in advance.
12
by: blueblueblue2005 | last post by:
Hi, here is an example I copied from Deitel C++ book. but when I compile it, always get the above compilation error, no matter how I change the include order, please help. here is the files:...
4
by: Grant Edwards | last post by:
I'm using xml.sax to parse the "datebook" xml file generated by QTopiaDesktop. When I look at the xml file, some of the attribute strings have newlines in them (as they are supposed to). ...
4
by: Karl Seguin | last post by:
Some of our users behind firewalls (watchguard in particular) are reporting that they can't access our site. This is the type of error they are getting: 02/06/04 07:27 http-proxy: removing...
2
by: LilBuh | last post by:
hi there :) i ve been looking for some time a way to print an html file from vb.net i came up with this code for printing and removing the header and footer from IE then once the printing is done...
22
by: macAWM | last post by:
Hi list, First let me explain that my background is in Java and I am quite spoiled to its niceties (read "less ambiguous nature"). Anyway to my problems. 1. I want to write my own library for...
2
by: Mario Krsnic | last post by:
Hello everybody, I have in a VWD-Project several sqldatasource- controls and I bind them during runtime with DetailsView: SqlDataSource2.SelectCommand = "select field1 from Tab1 where id= " & 4...
11
by: Gary Wessle | last post by:
Hi is it right to have a line like #include <path/to/header.hfor a library on my system, in my header file and use some functions provided by this library in the implementation file (file.cpp)...
9
by: Rajarshi | last post by:
Hi, I have some code that takes a string and obtains a compressed version using zlib.compress Does anybody know how I can remove the header portion of the compressed bytes, such that I only have...
3
by: pallav | last post by:
I have to header files, circuit.h and latch.h that reference each other and are causing a cyclic dependency. latch.h file #include "circuit.h" typedef boost::shared_ptr<struct LatchLatchPtr;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.