> Well, whether it causes an error not depends on your code. That's just
> the pattern you showed. It may not match anything, so nothing gets
> replaced with eregi_replace() and hence no "active link" is created, but
> it may not necessarily cause an error.
>
> Can you show me some of the code in context, with the pattern you showed
> earlier and how eregi_replace is being used? Thanks.
>
> ---John Holmes...
..................................................................

Sure.

BTW, here's a screenshot of the form and the result at:
www.gonefishingguideservice.com/php.htm

For a test, I put in a few spaces and then "s"  and then more spaces and
then "o" and then more spaces and then "s" and then I hit submit and the
script processed without an error.

So, I don't see where the eregi_replace() pattern matching is coming into
play.

Thank you.
TR
.......................................
Here is Larry Ullman's PHP script on page 130 -131:

//this is the html form

<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM METHOD=POST  ACTION="1201.php">
First Name<INPUT TYPE=TEXT NAME="Array[FirstName]" SIZE=20><BR>
Last Name <INPUT TYPE=TEXT NAME="Array[LastName]" SIZE=40><BR>
URL <INPUT TYPE=TEXT NAME="Array[URL]" SIZE=60><BR>
Description<TEXTAREA NAME="Array[Description]" ROWS=5
COLS=40></TEXTAREA><BR>
<INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
</FORM>
</BODY>
</HTML>

..................
 //this is the script called 1201.php which receives the data from the form.

<HTML>
<HEAD>
<TITLE>Using Regular Expressions</TITLE>
</HEAD>
<BODY>
<?php

if (($Array["FirstName"]) AND ($Array["LastName"]))
 {
   $Array["Name"] = $Array["FirstName"] . " " . $Array["LastName"];
 }

else
 {print ("Please enter your first and last names.<BR>\n");
  }

$Pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
$Replace = "<a href=\"http://\\2\\3\"; target=\"_new\">\\2\\3</a>";
$Array["URL"] = eregi_replace($Pattern, $Replace, $Array["URL"]);

print ("Your submission--$Array[URL]--has been received!<BR>\n");

?>
</BODY>
</HTML>





---
[This E-mail scanned for viruses by gonefishingguideservice.com]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to