You are here: Re: Does type=hidden have to be in a <form> in php? « PHP Language « IT news, forums, messages
Re: Does type=hidden have to be in a <form> in php?

Posted by Michael Fesser on 06/02/07 17:25

..oO(joboils@hotmail.com)

>I am trying various versions of this piece of code -
>
>print("<input type=\"hidden\" name=\"table\" value='$TableName'>");
>
>(the $TableName is a variable, depending on which file it is in) and
>want to use it following a link -
>
><a href=\"envelope_print.php?id=$Row[id]\">$Row[id]</a>
>
>so that the receiving file can use it like -
>
>$TableName=$_REQUEST['table'];
>$Query="SELECT * from $TableName where id='$id' ";
>
>but none of them work.

You would have to append the table name to the link, then you can access
it with $_GET['table'] in the receiving script. A hidden input element
would require a form with a submit button, not a link.

I also hope that the above code is just an example and will _never_ be
used on a real site in that way. Using a variable from the outside
without any kind of validation in a query is a huge security hole (SQL
injection is the keyword).

>I expect I'm doing something really stupid but I can't think what.
>I have session_start(); at the beginning of each file and
>register_globals() is On.

Should be off.

Micha

 

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

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