lukew96 Posted November 25, 2013 Share Posted November 25, 2013 im trying to get my trim function to work is this right, im pretty new to this so sorry if its a stupid question. <tr> <td>Name:</td><td> <input type="text" name="name"><?trim($str);?></td> <td><span class="error">* <?php if (isset($errors['name'])) echo $errors['name']; ?></span></td> </tr> and im getting an error like this Undefined variable: str Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 What are you trying to do? Quote Link to comment Share on other sites More sharing options...
Jayden_Blade Posted November 25, 2013 Share Posted November 25, 2013 Do that in your registration check, if you are registering users. $str = ($_POST['name']); $clean=ltrim($str,""); Echo ('$clean'); Quote Link to comment Share on other sites More sharing options...
Jayden_Blade Posted November 25, 2013 Share Posted November 25, 2013 What are you trying to do? He wants to remove extra spaces like " Dave" Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 (edited) Echo ('$clean'); That will echo the string $clean not the value for $clean. No need for the quotes or (). All you need is $name = trim($_POST['name']); Edited November 25, 2013 by Ch0cu3r Quote Link to comment 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.