You are here: Re: problem with php + form + input type = "hidden" « PHP Programming Language « IT news, forums, messages
Re: problem with php + form + input type = "hidden"

Posted by AnrDaemon on 10/17/07 11:59

Greetings, dba.
In reply to Your message dated 17 октября 2007 г., 05:19:43,

d> Without giving a lot of script at this time, I am having a problem with
d> php and form input type="hidden". Problem is that the hidden variable
d> displays last line from database query.

d> Some code.
[snip]

d> produces this from form:
[snip]

d> after selection from form $_POST produces
d> correct name "Dant, Norbert" but grabs last number "0005" and not "0020".

First, to lower chance of messing with output, use templates.
Second... Don't forget to escape output.

That way, Your code may looks like this

<?php

if ($field_name=="member_lname")
{
$_name = htmlspecialchars($result['member_lname'] . ', ' . $result['member_fname']);
$_id = $result['member_id'];
echo "<input type='radio' name='selection' value='{$_name}'/>$_name<br />";
echo "<input type='hidden' name='member_id' value='{$_id}'/>";
}

?>

Good luck with this code :)

P.S.
Aside from that, I think You would be better with
echo "<input type='radio' name='selection' value='{$_id}'/>$_name<br />";


--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>

 

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

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