PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old July 18th, 2002, 12:01 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
getting text

I want to retrieve the current text from a text input field in a form, so far the only way I've found is by submitting the whole form and getting via $_POST. This is not ideal, could someone point me in the right direction? I'm fairly new to php and spend most of my time looking at completely the wrong part of the manual but I'm sure the answer is usually in there.

Cheers folks,

Alan

Reply With Quote
  #2  
Old July 18th, 2002, 12:54 PM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: getting text

i dont understand what you mean, as far as i know, the only way you can get text from a text input field is by submitting the form..

Reply With Quote
  #3  
Old July 18th, 2002, 01:14 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: getting text

what I'm after doing is providing a textbox and a button in one frame. The idea is to enter a url in the textbox and click the button. This should then load the url in a second frame. I wanted to use the present value of the textbox to set the 'action' part of the form to the url. Of course if there is another way of achieiving the result I'd be happy to hear of it.

Alan

Reply With Quote
  #4  
Old July 18th, 2002, 01:38 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: mysql?

Here's a basic script to do what you want...you will load this in the top frame to show the text field and button and when it is submitted, it will go in the bottom frame...it has basic error checking just to make sure the http:// wasn't left off...

php Code:
Original - php Code
  1. <?
  2. if(isset($_POST['url'])) {
  3.     if(substr(strtolower($_POST['url']),0,7) == 'http://') {
  4.         $goto = $_POST['url'];
  5.     } else {
  6.         $goto = 'http://' . $_POST['url'];
  7.     }
  8.     header("Location: " . $goto);
  9. } else {
  10.     echo "<FORM method="POST" action="".$_SERVER['PHP_SELF']."" target="lowerframe">n";
  11.     echo "<INPUT type="text" name="url" size="30"><BR>n";
  12.     echo "<INPUT type="submit" value="GO!">n";
  13.     echo "</FORM>n";
  14. }
  15. ?>

Reply With Quote
  #5  
Old July 18th, 2002, 03:14 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: getting text

okay I've been playing with variations of your code for some time and can't get it to work, the lowerframe is changed, but to a blank page/frame. Everyhting up to the header(Location:....) works but even if you put in absolute address the result is the same. Looking at the online manual it seems lots of folks have had problems with header() and it leads to me to suspect that I may be affected by a bug in the browser, however its the only one I've got to play with so I can't check it.

Any further suggestion are still appreciated and thank you for the help so far.

Alan

Reply With Quote
  #6  
Old July 18th, 2002, 03:24 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: getting text

You might try switching out the header line with this:

php Code:
Original - php Code
  1. echo "<META HTTP-EQUIV=Refresh CONTENT="0; URL=".$goto."">";



Reply With Quote
  #7  
Old July 18th, 2002, 03:46 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: getting text

go Matt!

Cheers for that, it works now and is as lovely as it needs to be. Like I said I am new to the business of both php and html and not surprisingly the little niggles of both keep catching me out. Still I'm getting better and so long as good folks such as those that inhabitat the community here keep doing what they're doing it will soon enough be me handing out help to other folks.

Once again thanks and keep it up chaps (and chapesses!)

Alan.

Reply With Quote
  #8  
Old July 18th, 2002, 05:31 PM
XeIDy XeIDy is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Khi, SD, PK
Posts: 2 XeIDy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to XeIDy Send a message via AIM to XeIDy Send a message via Yahoo to XeIDy
RE: Which version

Which version of PHP you are using if it is older than 4.2 than.. use $HTTP_POST_VARS[]; instead of $_POST

ok?

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > getting text


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway