Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

forms in php?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

forms in php?

Postby infomorelos » 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
infomorelos
New php-forum User
New php-forum User
 
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico

Postby Redcircle » 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?
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

sounds interesting

Postby infomorelos » 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
infomorelos
New php-forum User
New php-forum User
 
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico

Postby Redcircle » 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>';
}
?>
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

that's a progress

Postby infomorelos » 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
infomorelos
New php-forum User
New php-forum User
 
Posts: 14
Joined: Mon Jan 27, 2003 12:10 am
Location: Cuernavaca, Mexico


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron