| | Quite useful replies, thanks |
|
|
CODE <?php include("../config.php"); if($submit) { $title = $_POST['title']; $short = $_POST['short']; $full = $_POST['full']; if(!$title){ echo "Error: The book's title is reguired field. Please, fill it."; exit(); } $result = mysql_query("INSERT INTO books (title, dtime, text1, text2) VALUES ('$title',NOW(),'$text1','$text2')",$connect); echo "<b>Thank you! News added Successfully!<br>You'll be redirected to Home Page after (4) Seconds"; echo "<meta http-equiv=Refresh content=4;url=index.php>"; } else { ?> <br> <h3>Add Books</h3> <form method="post" action="<?php echo $PHP_SELF ?>"> Title: <input name="title" size="40" maxlength="255"> <br> Text1: <textarea name="text1" rows="7" cols="30"></textarea> <br> Text2: <textarea name="text2" rows="7" cols="30"></textarea> <br> <input type="submit" name="submit" value="Add News"> </form> <? }//end of else ?>
//Edit I tried this CODE <? echo($_PHP_SELF); ?> and did not work, because of wrong or my php version.But this CODE <? echo($_SERVER["PHP_SELF"]); ?> worked properly and wrote the file path+name .I think you should use $_SERVER["PHP_SELF"] Did you remember what I have written about $PHP_SELF and $_PHP_SELF? Quite useful replies, thanks So you found $_SERVER["PHP_SELF"] is useful. CODE <form method="post" action="<?php echo $PHP_SELF ?>"> Here you wrote $PHP_SELF again. I said this is not working, but you are still using. My analysis are the same with the previous again. So you don't agree with my suggestions or you are kidding, right? Regards...
Listen, this code thing does work. It does not update the database at all, what's the problem?
Listen, this code thing does work. It does not update the database at all, what's the problem? Than sorry me, so the problem is about updating the database.But there is no update database code you specified. There is only insert database code. CODE mysql_query("INSERT INTO books (title, dtime, text1, text2) VALUES ('$title',NOW(),'$text1','$text2')",$connect); If there is a problem it must be about insert. By the way $text1 and $text2 are undefined in previous lines, they are not defined.
Thanks. I should change those variable and try it again.
Recent Queries:-
Keywords : Alex39s Trials Mistakes
|
|
![]() Alex's Trials. - Find Mistakes? |