Add to Google

Alex's Trials. - Find Mistakes?

Pages: 1, 2
free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Alex's Trials. - Find Mistakes?

alex1985
Quite useful replies, thanks

Reply

alex1985
Please, check the following one:

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

?>

 

 

 


Reply

Erdemir
QUOTE(Erdemir @ Jun 12 2008, 10:37 PM) *
//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?

QUOTE(alex1985 @ Jun 17 2008, 06:59 PM) *
Quite useful replies, thanks

So you found $_SERVER["PHP_SELF"] is useful.

QUOTE(alex1985 @ Jun 17 2008, 07:24 PM) *
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...

Reply

alex1985
Listen, this code thing does work. It does not update the database at all, what's the problem?

Reply

Erdemir
QUOTE(alex1985 @ Jun 17 2008, 07:47 PM) *
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.

Reply

alex1985
Thanks. I should change those variable and try it again.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Pages: 1, 2
Recent Queries:-
  1. $_php_self?page - 239.06 hr back. (1)
  2. $_php_self - 1079.98 hr back. (1)
  3. $_php_self what is - 1080.45 hr back. (1)
  4. alex erdemir - 1549.13 hr back. (2)
Similar Topics

Keywords : Alex39s Trials Mistakes





    Looking for alexs, trials, mistakes,






*SIMILAR VIDEOS*
Searching Video's for alexs, trials, mistakes,

*MORE FROM TRAP17.COM*
advertisement



Alex's Trials. - Find Mistakes?