...

View Full Version : Strange problem with textarea tag and php



heyseuss
10-04-2004, 02:19 AM
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:


<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

sir pannels
10-04-2004, 01:19 PM
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?

ReadMe.txt
10-04-2004, 09:00 PM
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.

Kurashu
10-05-2004, 12:01 AM
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.

sir pannels
10-05-2004, 03:46 PM
lol read me.. yeah thats what I said... only i included the vars :p

heyseuss
10-06-2004, 12:28 AM
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/proposal_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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum