james212121 Posted August 2, 2013 Share Posted August 2, 2013 Getting this error: Warning: Header may not contain more than a single header, new line detected in While using POST and GET between variabales: <?php $name = $_POST["Name"]; $email = $_POST["Email"]; $title = $_POST["Title"]; $rating = $_POST["Rating"]; $review = $_POST["Review"]; $broker = $_GET["Broker"]; header("Location: /thankyou-review.php?Name=$name&Email=$email&Title=$title&Rating=$rating&Review=$review&Broker=$broker");?> Please note the $review parameter is a pargaph that contain text and breaklines. Please advise. Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/ Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 $review = urlencode($_POST["Review"]); or $_POST = array_map('urlencode', $_POST); Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443200 Share on other sites More sharing options...
james212121 Posted August 2, 2013 Author Share Posted August 2, 2013 The error is gone, but the text is not inserted to MYSQL Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443204 Share on other sites More sharing options...
lemmin Posted August 2, 2013 Share Posted August 2, 2013 You haven't posted any code or other information about an SQL query. Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443221 Share on other sites More sharing options...
james212121 Posted August 2, 2013 Author Share Posted August 2, 2013 This is the insert MYSQL query: $insertreview = "INSERT INTO userreview (Name, Email, Title, Rating, Review, Status, Broker) VALUES ('$name','$email','$title','$rating','$review','0','$broker')"; Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443252 Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 //$result = query using $insertreview if(!$result) { echo mysqli_error(); } Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443253 Share on other sites More sharing options...
james212121 Posted August 2, 2013 Author Share Posted August 2, 2013 Got this MYSQL Error: Query: INSERT INTO userreview (Name, Email, Title, Rating, Review, Status, Broker) VALUES ('Raul','raul@gmail.com','It's OK!','5','Tra...Error Code: 1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's OK!','5','Trading there for 2 months, I'm Spanish speaker so I have my dedicat' at line 1Execution Time : 0 secTransfer Time : 0 secTotal Time : 0.040 sec I think it happens becuase of the ' Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443254 Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 (edited) Are you not using mysqli_real_escape_string() or similar on vars before inserting? You need to find some good and recent tutorials. Edited August 2, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443255 Share on other sites More sharing options...
james212121 Posted August 2, 2013 Author Share Posted August 2, 2013 No, I'm not. Try to search it on Google look complicated. How would you use it in this code: $insertreview = "INSERT INTO userreview (Name, Email, Title, Rating, Review, Status, Broker) VALUES ('$name','$email','$title','$rating','$review','0','$broker')"; Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443256 Share on other sites More sharing options...
AbraCadaver Posted August 2, 2013 Share Posted August 2, 2013 (edited) I still don't know what database functions you're using (look at my sig), but where ever you define the vars you need: $name = mysqli_real_escape_string($link, $_GET['name']); Edited August 2, 2013 by AbraCadaver Quote Link to comment https://forums.phpfreaks.com/topic/280770-warning-header-may-not-contain-more-than-a-single-header-new-line-detected-inea/#findComment-1443257 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.