Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-04-2004, 01:19 AM   PM User | #1
heyseuss
New to the CF scene

 
Join Date: Sep 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
heyseuss is an unknown quantity at this point
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
heyseuss is offline   Reply With Quote
Old 10-04-2004, 12:19 PM   PM User | #2
sir pannels
Regular Coder

 
Join Date: Jun 2002
Posts: 905
Thanks: 23
Thanked 5 Times in 5 Posts
sir pannels is an unknown quantity at this point
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..

Quote:
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?
sir pannels is offline   Reply With Quote
Old 10-04-2004, 08:00 PM   PM User | #3
ReadMe.txt
Regular Coder

 
Join Date: Jun 2002
Location: Sheffield, UK
Posts: 552
Thanks: 0
Thanked 0 Times in 0 Posts
ReadMe.txt is an unknown quantity at this point
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)
ReadMe.txt is offline   Reply With Quote
Old 10-04-2004, 11:01 PM   PM User | #4
Kurashu
Regular Coder

 
Join Date: Aug 2004
Location: The US of A
Posts: 767
Thanks: 1
Thanked 0 Times in 0 Posts
Kurashu is an unknown quantity at this point
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..
Kurashu is offline   Reply With Quote
Old 10-05-2004, 02:46 PM   PM User | #5
sir pannels
Regular Coder

 
Join Date: Jun 2002
Posts: 905
Thanks: 23
Thanked 5 Times in 5 Posts
sir pannels is an unknown quantity at this point
lol read me.. yeah thats what I said... only i included the vars
sir pannels is offline   Reply With Quote
Old 10-05-2004, 11:28 PM   PM User | #6
heyseuss
New to the CF scene

 
Join Date: Sep 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
heyseuss is an unknown quantity at this point
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
heyseuss is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:59 AM.


Advertisement
Log in to turn off these ads.