Hi,
I have a php form that requests info from the user - some text boxes and a text area. The user can use an edit button to go back and edit his/her info before submitting the final form. Problem is that ltrim() does not work on all of the variables. I am still getting leading white spaces on some of the variables, while others aren't when the user uses the edit button to go back. I have checked my code carefully. Same thing going on with the stripslashes(). In some sections, it removes the "/" in front of apostrophes and in others, it doesn't.
Any suggestions?
Thanks, Kimber
ltrim() and stripslashes() are not consistent
Moderator: General Moderators
ltrim() & stripslashes() not being consistent
Code: Select all
<input type="hidden" name="firstName" value=" <? $firstName = ltrim($firstName); print stripslashes($firstName) ?> ">
<input type="hidden" name="lastName" value="<? $lastName = ltrim($lastName); print stripslashes($lastName) ?> ">
<strong><div style="margin-right: 150px"><? $message=ltrim($message); print stripslashes($message); ?></div></strong>The message gets indented and broken up over numerous lines when printed out in the text area, if the user goes back to edit their info. It is also escaping any apostrophes that the user might enter in their message. If the user goes back more than once, it is a real mess. However going from the form to the confirm screen, it does NOT escape anything and behaves quite nicely. My problems are going backward to edit the original info. AAUGH.
Any help would be greatly appreciated.
Thanks, Kimber
leading spaces & escaped apostrophes
Thanks for pointing out the spaces in the code. They are gone now.
The code used for the textarea in the file that the user posts to an email:
This code makes for very pretty stuff when printed to screen. However, the spaces (looks like multiple tabs and hard breaks) show up when printed in a textarea.
When the user is satisfied with their input the form is submitted to an email which is great except for the spaces and the ENT_QUOTES prints out the ' where the apostrophe would have been and the escape backslash is there also?!????.
thanks for your help! lauren
The code used for the textarea in the file that the user posts to an email:
Code: Select all
<strong><div style="margin-right: 150px"><? $message=ltrim($message);
$message=htmlspecialchars($message, ENT_QUOTES); print stripslashes($message); ?></div></strong>Code: Select all
<textarea id="message" name="message" wrap="hard" cols=70
rows=10 width="120" onKeyDown="textCounter(this.form.message,this.form.remLen,480);"
onKeyUp="textCounter(this.form.message,this.form.remLen,480);">
<?php $message = ltrim($message); print stripslashes($message); ?></textarea>thanks for your help! lauren