Hi Marian,
Couldn't you have the form on the same page:

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Name must contain letters and numbers only<br />
and be between 8 and 30 characters in length<br />
<input type="text" name="dirnamewanted" size="20" maxlength="40" />
<input type="submit" value="Submit" />
</form>

<?php
if (isset($_POST['dirnamewanted'])) {
  $dirname = strip_tags($_POST['dirnamewanted']);
  $dirname = strtolower($dirname);
  $dirname = preg_replace('/[^a-z0-9]/','',$dirname);
  $dirname = substr($dirname,0,30); //30 max

  if (!empty($dirname) && strlen($dirname) <8) {
    echo "<p>Name '$dirname' must be at least 8 characters long.<br />
    Please choose a longer name!</p>";
  }
  elseif (strlen($dirname) >=8) {
    echo "<p>Directory '$dirname' created</p>";
  }
}
?>


----- Original Message ----- 
From: "Marian Briones" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, August 08, 2005 9:17 PM
Subject: Re: [php-list] Re: Getting rid of unwanted characters in a string


>I couldn't get the other code to give the user back an error to work  
> either.
> 
> In one instance, where they are uploading a photo, there is no reason  
> for the user to know that the name was changed (to protect the  
> innocent).  But it is true, it would be better if I could give back an  
> error if it sees that there is illegal stuff in the form submission.
> 
> I dont' know why it isn't working, but I am so frustrated I'm ready to  
> chuck the file folder out the window and let the dusty cat eat it...



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12hqp6fiu/M=362329.6886308.7839368.1510227/D=groups/S=1705005703:TM/Y=YAHOO/EXP=1123551446/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to