I am having something strange happen.
My script is for editing information.
When I send the $_POST from my textarea to my php page. It sanitizes and inserts correctly, but I also want to re-output the data if called upon again. So i am basically using jquery $post to send and retrieve the information.
It all works great, except when I call the info back with the edit button and function “onmousedown” it is not giving me the correct format for my parameters.
If I only write on one line it comes out perfect, but if I use multiple lines it won’t retain the line breaks and it chops off the closing ” ‘ ” so the function cannot be reset. Any ideas? Here is my callback echo. Thanks in advance…
The problem is in the “$againList” parameter…
$againList = $_POST['updated_songList']; // I am sending back the exact same data that was given without filter...
echo '<span><h4 style="margin-bottom:0px; font-size:14px;">'.$full_birthday.'
<a href="#" onclick="deleteSongList('.$songid.');" style="color:gray; float:right; font-weight:100; font-size:12px;">delete</a>
<a href="#" onclick="return false" onmousedown="editSongList(\''.$songid.'\', \''.$againList.'\');" style="margin-right:5px; color:gray; float:right; font-weight:100; font-size:12px;">edit</a></h4>'.$song_list.'<br /></span>';
If you need anything else let me know. Thanks!
Okay, so I figured it out and got it running. Thanks for all the help everyone!
The problem seems to be that you must at least add the “stripslashes” function to a $_POST before you can place it into a javascript parameter otherwise, I seems like at every ‘\n’ it stops the function call and give the error “there is an unterminated string literal” meaning your last parameter does not have an ” ‘ ” at the end of it. I am not sure why though. If anyone has any insight, I would appreciate the learning experience.
Thanks everyone!