I have recently decided to recode my webpage, webarooski.com using CSS as apposed to the tables I had been using. edit oh yea - the one I am working on is at http://www.webarooski.com/css-php/index.htm edit However, half way through a few classmates approached me and told me they would like to host their literature/images on my page - which I said would be fine. Thinking about it - it would be a real cumbersome task for everyone to have to e-mail everything they do to me, have me html it up and upload it...so...I decided to learn a bit of php.
So far - I have a mysql database setup with only one table - literature (easiest place for me to start). I made a simple form that asks
Author
Title
Text
(eventually type, for poem/short story/editorial/whatnot)
This worked fine, and gave me all the information I needed. However, a problem quickly came to surface - the php output did not like spaces, and the javascript did not like them either :-(
I needed 3 different versions of the title to use my nifty div-change-script-thingy I wrote for a previous version (it allows people to scroll through content, in this case poetry, without having to reload any page - it just changes the content of a couple divs).
What I need is a way for the user to type
'This is THE titLe to My PoEM!'
and have it save three values to the database
'This is THE titLe to My PoEM!'
'This%20is%20THE%20titLe%20to%20My%20PoEM!'
'thisisthetitletomypoem!'
or even better yet - when it reads from the database have it output in those two fasions (the first would be in the D😎
For now I have the forum just asking extra questions
JS Title
Variable Title
A second - very related issue I have is with how it saves the article itself to the database. I am going to post the source code to the litadd.php file and the processlit.php file as a reply - but heres the problem.
If sombody types the following into the article box:
Ashes to ashes
Dust to Dust
Live to learn
Learn to trust
and so on and so forth...
it saves it directly to my database as such - however, because of the way I have it outputting the javascript variables (Ill post a few pages of source as replies actually) I need it to be stored like this
Ashes to ashes<br>Dust to dust<br>Live to learn<br>Learn to trust<br>and so on and so forth...
all on one line with breaks like that.
Thanks in advance for any help - I tried searching google for 'string php formatting' but did not really come up with anything useful, and I am not even sure thats what I am looking for :-)