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 Link to comment https://forums.phpfreaks.com/topic/284257-how-can-i-get-this-to-work/ Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 What are you trying to do? Link to comment https://forums.phpfreaks.com/topic/284257-how-can-i-get-this-to-work/#findComment-1459974 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'); Link to comment https://forums.phpfreaks.com/topic/284257-how-can-i-get-this-to-work/#findComment-1459975 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" Link to comment https://forums.phpfreaks.com/topic/284257-how-can-i-get-this-to-work/#findComment-1459976 Share on other sites More sharing options...
Ch0cu3r Posted November 25, 2013 Share Posted November 25, 2013 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']); Link to comment https://forums.phpfreaks.com/topic/284257-how-can-i-get-this-to-work/#findComment-1459979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.