forms in php?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
infomorelos
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico

Wed Feb 05, 2003 4:21 pm

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
Thank you in advance

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Wed Feb 05, 2003 4:45 pm

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?

infomorelos
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico

Thu Feb 06, 2003 9:40 pm

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
Thank you in advance

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Fri Feb 07, 2003 2:51 am

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>';
}
?>

infomorelos
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico

Fri Feb 07, 2003 4:20 pm

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
Thank you in advance

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 5 guests