You are here: Re: html to php variable communication « PHP Language « IT news, forums, messages
Re: html to php variable communication

Posted by George King on 11/17/61 11:21

"ft310" <ft310@yahoo.com> wrote in message
news:YR9Be.52$0G4.647@eagle.america.net...
> The following code is lifted from an html / php page -- all of the error
> checking and other stuff is removed but is there and working in the actual
> page.
> The issue is moving between html variables and php variables.
>
> I understand html variables holdCounty, holdState and County are not
> available to a $_Post function until the Submit function is engaged.
>
> My question: Is there anyway, short of the round trip caused by either
> clicking the Submit button or simulating the same action in javascript, to
> move the html variables into a php context. It is very hard to justify
> this
> methodology as there are all sorts of User impacts. I can not believe this
> is a unique issue and it must have been solved before. I'm a newbee and
> need
> help please as I hate making Users work -- bad form.
>
> $localCounty=$_POST[holdCounty] ;
> $localState=$_POST[holdState] ;
> $localTest=$_POST[County] ;
>
> $s_sqlT1="SELECT Town, Area, State, County FROM LocationsGB " ;
> if ($localTest=="All")
> {
> $s_sqlT2 = "" ;
> }
> else
> {
> $s_sqlT2="WHERE County='".$localCounty."' AND
> State='".$localState."' " ;
> }
> $s_sqlT3="GROUP BY State, Town ORDER BY State DESC, Town, Area" ;
> $s_sqlT0=$s_sqlT1.$s_sqlT2.$s_sqlT3 ;
>
> $dbt=mysql_connect('localhost', 'rhodeisl_ft310', 'billwilson') ;
> mysql_select_db('rhodeisl_RISC',$dbt) ;
> $resultT=mysql_query($s_sqlT0,$dbt) ;
>
> At the end of this there is no information returned from the database.
>
> NOTES:
> A. The full SQL statement is constructed ($s_sqlT0) but the values for
> $localCounty and $localState are not there
> B. Appropriate information is in the database.
> C. It appears the SQL statement works when tested standalone.
> D. holdCounty and holdState are html form text boxes and have
> information
> in them
> E, County is the result of an html drop down list selection
>
> tooheys@fullchannel.net
>
>

Remember that the web is a stateless environment - your server sent the page
as requested, and will have no knowledge of anything else related to that
particular visitor until that visitor sends in another request - in your
case, with information filled out in the form. No click/submit - no
information to the server.

George

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация