[PHP-DB] Variable from PHP to HTML...
I am attempting to create a form of system names that is populated from a database query. The database query is working fine, and the form population is actually working fine also. The question I have is about organizing the variables that result from the form. I want to use the system name as the variable name but I am having trouble figuring out how to do this. Below is what I currently have working: form name=form1 method=post action= table border=0 align=center ?php do { $sys = $system['Name']; if ($cnt == 1) { $cnt = 2; echo tr; ? td width=161input name=system type=checkbox value=name ?php echo $sys; ?/td I would like to be able to access this variable $sys from the HTML code. Is this possible? I am thinking something like this, but it doesn't appear to work: form name=form1 method=post action= table border=0 align=center ?php do { $sys = $system['Name']; if ($cnt == 1) { $cnt = 2; echo tr; ? td width=161input name=$sys type=checkbox value=name ?php echo $sys; ?/td Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Variable from PHP to HTML...
form name=form1 method=post action= table border=0 align=center ?php do { $sys = $system['Name']; if ($cnt == 1) { $cnt = 2; echo tr; ? td width=161input name=$sys type=checkbox value=name ?php echo $sys; ?/td Your input box should be the following: input name=sys type=checkbox value=name The $ isn't necessary in the HTML code since HTML doesn't really recognize this as a variable. When the form is passed to the action page, the code in the action page (in this case PHP) creates a variable named whatever the name attribute in the HTML code holds - in this case sys. -Lisi -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Variable from PHP to HTML...
If the last reply didn't help you, try this: tdinput name=?php echo $sys; ? type=checkbox value=name?php echo $sys; ?/td Another way to write, if you aren't worried about ? being used by another processor: tdinput name=?=$sys? type=checkbox value=name?=$sys?/td Peter On Tue, 12 Nov 2002, NIPP, SCOTT V (SBCSI) wrote: I am attempting to create a form of system names that is populated from a database query. The database query is working fine, and the form form name=form1 method=post action= table border=0 align=center ?php do { $sys = $system['Name']; if ($cnt == 1) { $cnt = 2; echo tr; ? td width=161input name=$sys type=checkbox value=name ?php echo $sys; ?/td --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php