odds and ends

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wallabee
Forum Newbie
Posts: 20
Joined: Mon Apr 21, 2003 10:01 pm

odds and ends

Post by wallabee »

it seems that my program only has two more problems. with the problems, it functions fine, but if i were to eliminate the two problems, i'm considering myself done, and only if i were to eliminate the two problems.

FIRST:
how do you check to see if checkboxes have been checked from a form that's been submitted. say the name of the checkbox is

Code: Select all

<INPUT TYPE=checkbox NAME="checkAdmissions">
, what would be the syntax to make sure it's been checked from the form that takes in the submission? my assumption would be

Code: Select all

if ($_POST['checkAdmissions'] == true)
Is this the correct syntax, and I'm just doing something quirky that's making it not work?

SECOND:
My script writes text to a text file using fwrite. After submitting the text and I check the text file, it seems that all of the apostrophe's have been escaped with a \. When I used fopen to pull the text back into PHP, all the apostrophe's have still been escaped. What's the way around this? I think I remember seeing a command which eliminates all the escape characters. Anyone?


Thanks for all of your help over the past few days guys.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

IF (isset($_POST['checkAdmissions']))

and

stripslashes()

Sounds like you maybe don't have the php manual? Recommend you download the version with user comments from php.net.
wallabee
Forum Newbie
Posts: 20
Joined: Mon Apr 21, 2003 10:01 pm

Post by wallabee »

the aim of the script is to edit text files which a macromedia flash file relies on for some of it's text. that said, stripslashes() seems to only work on incoming strings, which is great if you're looking for stripped slashes in your PHP script, but not so great if you're trying to access the text file with another language/program after it's been written.

that said, is there even a logical way to keep PHP from placing \ before all apostrophes? or am i going to have to find a way in flash to keep them from printing out.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Sounds like you maybe don't have the php manual? Recommend you download the version with user comments from php.net.
You can download the annotated version of the manual? Would love to have that one (only using the standard version atm). Just had a look at php.net and couldn't find a link to that the commented one. Care to post a link?
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

http://weblabor.hu/php-doc-chm/

Can't remember exactly where I got it but I think that's the one - let me know if not. I could even email it to you if the file isn't too big.

The user notes are very informative so it's worth taking the trouble to track it down.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Thanks a lot, mate! Just downloaded it. :)
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

was lookin' for that too, thanks. =)
Post Reply