Page 1 of 1

forms in php?

Posted: Wed Feb 05, 2003 4:21 pm
by infomorelos
Hi,
Usually (lol), I make html forms in Dreamweaver and lateron, I try to combine them with php and mysql editiing the code in notepad or similar.

I was wondering, if I could built the tables directly in php. In other words: is it necessary to built tables and then insert php code into the form fields?

Thank you in advance

Posted: Wed Feb 05, 2003 4:45 pm
by Redcircle
you can use php to echo all the information.

Code: Select all

<?php

echo '<table>'."\n";
echo '  <tr>'."\n";
echo '    <td>'."\n";
echo 'blah blah blah'."\n";
echo '    </td>'."\n";
echo ' </tr>'."\n";
echo '</table>';

?>


is that what you meant?

sounds interesting

Posted: Thu Feb 06, 2003 9:40 pm
by infomorelos
sounds interesting.
now, if you want to put some php instructions into those echoed table fields, you just open/close curly brackets and write code in between? Or how do you embed the field content (which is php too)?

thank you in advance

Posted: Fri Feb 07, 2003 2:51 am
by Redcircle

Code: Select all

<?php 
$query = 'select somehting asldfjlj ';
$result = mysql_query($query);
while($myrow=mysql_fetch_row($result))
{
echo '<table>'."\n";
echo '  <tr>'."\n";
echo '    <td>'."\n";
echo 'blah blah blah'.$myrow[0];
echo '    </td>'."\n";
echo ' </tr>'."\n";
echo '</table>';
}
?>

that's a progress

Posted: Fri Feb 07, 2003 4:20 pm
by infomorelos
That is already something. However, when I use this code, I get as a result a list of all rows in the table, how could I limit them to just the first row, or just the rows that contain 'somethin'?

Thank you in advance