Forum Moderators: coopster
I need a little advice....
I`m coding a guestbook for my website and I have written the sign.php page. When the page loads you get the form (with for instance, name, email, location, hopepage, commets etc) and a button "Preview Entry" to preview your entry. When thats clicked you get a preview of the entry and a "Sign Guestbook"button to click if you are happy with your entry.
Now, there are two "if" statements in the code. The first generates if the "Preview Button" is pressed, the second if the "Sign Guestbook" button is pressed. The second statment has the mySQL queries to write to the database. When I pass the information from the form into the first statement, it displays a preview of the post. Thats fine.
However, to get the information into the database I`m also passing the variables into hidden variables into the first "if" statement, so that when "Sign Guestbook" is pressed, it takes the info from those and inserts it into the database.
So for example, on the form page I have:
<input type="text" name="name">
On the preview page I just use $name to display what was typed in. I also pass it into the hidden field. ie:
<input type="text" name="name" value="<? echo $name;?>">
This info gets written to the database. I hope I`m making sense so far.
So, the problems I`ve got are:
a) I`m using code to add URLS and mailto links. [url=http://blahblah.com]URL Name[/url].In the comments area you see URL Name. This gets passed to the hidden field as follows:
<input type="text" name="comments" value="<a href="http://blahblah.com" target=_blank>URL Name</a>">
This screws up because URL Name"> actually appears on the page.
b) The 2nd problem I`ve got is I`m using smilies. So :smile: would convert to the smile image using str_replace. Thats working fine. However, I`m using HTML formatted e-mails and if a smilie is used all I get in the email is a white box with a red cross. I`m not passing the smile info into a hidden variable, so I assume its something to do with that?
If I just use "Sign Guestbook" straight away, theres no problem.
I hope I`ve made some sense.
How would you guys go about passing the information to the two areas and then writing to the database?
Phew, think I`m done now.
Thanks for the help!
[1][[b]edited by[/b]: dreamcatcher at 10:19 am (utc) on May 30, 2003][/1]