| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
can you evaluate my code
Hi everybody
I'm writing PHP code to develope a web site. This work is for me just to learn the PHP language in order to get a new job. I need a help from you just to evaluate my work if I'm going in the right way or there is another good solutions . Note I didn't finish the work till now so I know still much work. So I hope that you can understand it easily and I will be thankfull for your help. First of all I supposed that my web site is a forum to discuss the varities of cooking and recipes The following four pages are navigated one by one. Now I will give the main code only: 1) forum.php First of all this the first page that contains the list of all food types as a hyperlink such soups, sweets, etc. Code:
<? $username=$_POST["username"]; ?> <TR> <TH align = left>Soups,Mazza, and juices</TH> </TR> <TR> <TH align = left>Pasta</TH> . . . 2)viewForum.php this page will display the forum that be selected from the page forum and passed f_no, username variables using GET. Code:
<?
$fno=$_GET['f_no'];
$username=$_GET['username'];
?>
<form method="get" action="PostTopic.php">
<input type="hidden" value="newtopic" name = "mode"> </p>
<input type="hidden" value="<? echo $fno ?>" name = "f_no"> </p>
<input type="hidden" value="<? echo $username ?>" name = "username"> </p>
<input type="submit" value="New Topic" name="newtopic"></p>
</FORM>
<?
$database="formdb";
mysql_connect(localhost);
@mysql_select_db($database) or die ("Unable to select database");
$query="select * from forums where f_no = '$fno'";
$res=mysql_query($query);
$fname=mysql_result($res,0,"f_name");
?>
// here to display Forums -> Soups,Mazza, and juices
Forums ->
<?
echo " ".$fname."
";
?>
3) posttopic.php here to post a new topic Code:
// to get username, f_no (forum no) <? extract($_GET); ?> <FORM METHOD=POST ACTION="postnew.php"> <INPUT TYPE="text" NAME="Ttitle"> <TEXTAREA NAME="texta" ROWS="20" COLS="60"></TEXTAREA> <input type = "hidden" name ="f_no" value ="<? echo $f_no ?>" > <input type = "hidden" name ="username" value ="<? echo $username ?>" > <input type="submit" name ="submit" value ="Submit"> </FORM> 4) postnew.php to apply the topic Code:
your topic is applied</p>
<?
extract($_POST);
$database="formdb";
mysql_connect(localhost);
@mysql_select_db($database) or die ("Can not connect to database");
$sql="insert into topics values('','$f_no','$username',now(),'$Ttitle','$te xta','1')";
mysql_query($sql)or die ('cannot insert because '.mysql_error());
mysql_close();
?>
Thank you for your understanding |
|
#2
|
|||
|
|||
|
good start
you can get help from php mannual extensively.
URL Enjoy using PHP ! |
|
#3
|
|||
|
|||
|
Thank you
|
|
#4
|
|||
|
|||
|
Extract is deprecated.
Also, you should check to make sure each variable is infact set, and before putting it into the database you need to make sure people arent trying to use DELETE strings etc.. |
|
#5
|
|||||
|
|||||
|
Acecool
Thank you for your reply Quote:
in which cases we can use it Quote:
Do you mean I must working with arrays. Quote:
sorry I couldn't understand. |
![]() |
| Viewing: Tutorialized Forums > Desktop Programming > Delphi > can you evaluate my code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|