Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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?
Reply With Quote
  #2 (permalink)  
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:17 AM.


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