Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34

Thread: Guestbook posting problem

  1. #11
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    Code:
    "</p><hr />\n"
    will work just like you want.

    I don't mean to butt in, but I used to do the same thing Bluewalrus. I think it starts because a lot of the time you are doing things like:

    Code:
    <?php echo '<p class="class"><a href="/">text</a></p>' . "\n"; ?>
    And in this case you would have to concatenate the \n because the single quotes are gonna print the literal \n if you don't. So depending on what you are echoing, sometimes you must concatenate, and sometimes you don't have to. It took me a while to get the hang of using single or double quotes, because like you, I like to find one way of doing something that works and stick to it.

  2. #12
    Join Date
    Jul 2008
    Location
    boston, ma
    Posts
    88
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Thanks so much Chris. I will try this tonight and see what happens!!!

  3. #13
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    PHP Code:
    $sendata="Email Address to respond to:"$visitormail;
    $q="Comment from "$visitor " "$notes "Submitted:" $todayis 
    I mean like that.. When your using double quotes - don't use conatenation... Unless there is a specific reason. Such as:
    Code:
    <?php
    $var = "Hello";
    $Hello = "GoodBye";
    echo $$var;
    ?>
    Jeremy | jfein.net

  4. The Following User Says Thank You to Nile For This Useful Post:

    bluewalrus (01-09-2009)

  5. #14
    Join Date
    Jul 2008
    Location
    boston, ma
    Posts
    88
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    A few things Chris,
    Does this just send the message to an email? or does it post to that page so anyone can see the message?
    The 3 sections of code you laid out, should each of those be php files?
    Also, how do I set permissions to the txt file, which is empty right?

    Thanks dude

  6. #15
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    If your in your ftp right click, or apple click, or ctrl click, and then look for something like file attributes (in filezilla), properties, permissions maybe and click it then there should be a bunch of check boxes containing owner, group and public you can either check of all those or type in 777 in the text area at the bottom. It can email you when a new post has been set if you want it to that line is commented out in the code I gave you if you delete that comment it will email you. The 2 sections need to be php, the form one doesn't need to be but can be if you want, if you want to log ip addresses you'll need it to be php. Let me know what ftp you using if the finding the permissions above didn't help.

  7. #16
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    oo okay nile thanks.

  8. #17
    Join Date
    Jul 2008
    Location
    boston, ma
    Posts
    88
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    ok Chris,
    So I put the small bit of php code in the div tags in "guests.php", I put the form in the html file, and I put the large bit of php code in guest_book.php. The txt has all permissions set to it.
    You can see the page here

    Here are the warnings I get! I was bound to get warnings on my first try!

    Warning: fopen(guestbook.txt) [function.fopen]: failed to open stream: Permission denied in D:\Hosting\3030954\html\HeadFirstGraphics\ourwedding\Chrisguestbook\guest_book.php on line 52

    Warning: fwrite(): supplied argument is not a valid stream resource in D:\Hosting\3030954\html\HeadFirstGraphics\ourwedding\Chrisguestbook\guest_book.php on line 57

    Warning: fclose(): supplied argument is not a valid stream resource in D:\Hosting\3030954\html\HeadFirstGraphics\ourwedding\Chrisguestbook\guest_book.php on line 59

  9. #18
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What are your permissions saying, 777? The other error's are from the text file not being able to open

  10. #19
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Run this:
    Code:
    echo fileperms('guestbook.txt');
    (and I'll do something to figure out the type), or run this:
    Code:
    echo substr(decoct(fileperms("thanks.php")),3);
    Last edited by Nile; 01-09-2009 at 09:44 PM.
    Jeremy | jfein.net

  11. #20
    Join Date
    Jul 2008
    Location
    boston, ma
    Posts
    88
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    right the first txt I had wasn't actually a txt file. So I uploaded a new txt file and right clicked. When I do I click on get info and I am able to see properties and permissions. Right now the permissions are 644, and when I go and change them to 777 and hit apply I get an error message.
    My server is windows through godaddy and the ftp is transmit

    Thanks
    Will

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •