Wrox Programmer Forums
|
BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143
This is the forum to discuss the Wrox book Beginning PHP 6, Apache, MySQL 6 Web Development by Timothy Boronczyk, Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz; ISBN: 9780470391143
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 14th, 2009, 04:22 PM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default urlencode error page 37

When browsing the movie1.php file, Iget the following...

Warning: urlencode() expects parameter 1 to be strictly a binary string, Unicode string given in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ch2\movie1.php on line 23

Here is the code, downloaded right from this site...

<?php
session_start();
$_SESSION['username'] = $_POST['user'];
$_SESSION['userpass'] = $_POST['pass'];
$_SESSION['authuser'] = 0;
//Check username and password information
if (($_SESSION['username'] == 'Joe') and
($_SESSION['userpass'] == '12345')) {
$_SESSION['authuser'] = 1;
} else {
echo 'Sorry, but you don\'t have permission to view this page!';
exit();
}
?>
<html>
<head>
<title>Find my Favorite Movie!</title>
</head>
<body>
<?php include 'header.php'; ?>
<?php
$myfavmovie = urlencode('Life of Brian');
echo "<a href=\"moviesite.php?favmovie=$myfavmovie\">";
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
<br/>
<br />
Or choose how many movies you would like to see:
<br/>
<form method="post" action="moviesite.php">
<p>Enter number of movies (up to 10):
<input type="text" name="num" maxlength="2" size="2"/>
<br/>
Check to sort them alphabetically:
<input type="checkbox" name="sorted" />
</p>
<input type="submit" name="submit" value="Submit"/>
</form>
</body>
</html>

Any ideas why I'm getting this error?
 
Old March 17th, 2009, 09:38 PM
Registered User
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you should typecast the string to binary like this: $myfavmovie = urlencode((binary) 'Life of Brian');
This is a php6 change.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Errata, page 37 theoxylo BOOK: Professional Java Development with the Spring Framework 0 December 6th, 2005 06:55 PM
problem with urlencode rajiv_software Classic ASP Basics 0 April 25th, 2005 02:04 AM
ch10 p 404 server.URLEncode dont work :( Timmo BOOK: Beginning ASP 3.0 0 February 3rd, 2004 03:44 PM
p404 URLEncode returning nothing Timmo ASP.NET 1.0 and 1.1 Basics 0 February 3rd, 2004 03:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.