Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Strange problem with textarea tag and php

    Hi,

    I've created a form in PHP that is controlled by a JavaScript expand/contract system. You can see what I've got by going to

    http://www.window.auckland.ac.nz/proposal.html

    And clicking the 'OnSite' link near the top to go the the form I'm having difficulties with.

    I've got some brief if statements checking that the required fields were filled out after the 'Review' button is pushed, and if not, the form reloads with what the user previously entered into the fields. The issue is that if someone hits the 'enter' button when writing something in the textarea boxes to start a new line in the textarea box, after which if you hit the 'Review' button the form fails to load! It seems such a strange thing to trip everything up.

    An example of the code to catch the POST information is below:

    PHP Code:
    <textarea name=postal_address rows=4>
    <?php if ($_POST['postal_address'] !="") { 
    echo 
    $_POST['postal_address']; 
    ?>
    </textarea>
    I'm wondering if there is a PHP function that would help in this situation. i've tried the strip_tags, and nlbr to no avail.

    Luke

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Hey Luke,

    this is strange, I think this maybe more a JS problem if you are using JS to control the field.. can we see the JS code?

    Looking at your PHP there though .. you have pretty much said..

    IF THERE IS NO POSTAL ADDRESS THEN PRINT POSTAL ADDRESS IN THE TEXTAREA.
    and so you see, that makes no sense - how can it post an address that doesnt exist yet? If this really what you are going for?

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Sheffield, UK
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sir pannels
    Hey Luke,

    Looking at your PHP there though .. you have pretty much said..

    IF THERE IS NO POSTAL ADDRESS THEN PRINT POSTAL ADDRESS IN THE TEXTAREA.

    and so you see, that makes no sense - how can it post an address that doesnt exist yet? If this really what you are going for?
    It actually says, "if it's not empty then print it". which is pretty redundant as if it's empty then theres nothign to print but an empty string.
    "To be successful in IT you don't need to know everything - just where to find it in under 30 seconds"

    (Me Me Me Me Me Me Me Me Me)

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    This more than likely a JS problem. Because, your code works just fine for me.

    Edit: Post the rest of your script, and I might be able to help you.
    Last edited by Kurashu; 10-04-2004 at 11:15 PM.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    lol read me.. yeah thats what I said... only i included the vars

  • #6
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hehe. Oh yeah, I recognise the if () isn't neccessary, but you know, if I wrote it before and it works then I thought why change it now?

    I've posted to the forum of COOLjsTree, which is the script I've used for the collapse/expand menu system.

    http://javascript.cooldev.com/forum/viewtopic.php?t=869

    But if any of you know JavaScript and want to try tackling the script. Then .. there's 3 files that have JavaScript in them. There's the main page itself:

    http://www.window.auckland.ac.nz/onsiteproposal.php

    View the source, and the script begins near the top with var "TREE1_NODES = [". Then there are two files being linked in:

    http://www.window.auckland.ac.nz/pro...tree_format.js
    http://www.window.auckland.ac.nz/proposal_tree.js

    I know this isn't a JavaScript forum so apologies for going a bit off topic.

    Many thanks
    Luke


  •  

    Posting Permissions

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