Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

error
Dear friends,

Script writes to database, however gives this error while on internet web
server, on local host doesn't give same error.

Any guidance, please

Thank you
-----------------------------------------
Back to Main
Notice: Undefined index: op in
 \\premfs15\sites\premium15\mrbushforpeac
e\webroot\replytopost.php on line 9
----------------------------------------------------------------------------
--
----
code of php script
----------------------------------------------------------------------------
--
----
<a href="www.abcdefg.us">Back to Main</a>

<?php
//connect to server and select database; we'll need it soon
$conn = mysql_connect("orf-mysql1.brinkster.com", "mrbushforpeace",
"poilkjmnb") or die(mysql_error());
mysql_select_db("mrbushforpeace",$conn)  or die(mysql_error());

//check to see if we're showing the form or adding the post
if ($_POST["op"] != "addpost") {
// showing the form; check for required item in query string
if (!$_GET["post_id"]) {
header("Location: topiclist.php");
exit;
}

//still have to verify topic and post
$verify = "select ft.topic_id, ft.topic_title from forum_posts as fp left
join forum_topics as ft on fp.topic_id = ft.topic_id where fp.post_id =
$_GET[post_id]";
$verify_res = mysql_query($verify, $conn) or die(mysql_error());
if (mysql_num_rows($verify_res) < 1) {
//this post or topic does not exist
header("Location: topiclist.php");
exit;
} else {
//get the topic id and title
$topic_id = mysql_result($verify_res,0,'topic_id');
$topic_title = stripslashes(mysql_result($verify_res,
0,'topic_title'));

print "
<html>
<head>
<title>Post Your Reply in $topic_title</title>
</head>
<body>
<h1>Post Your Reply in $topic_title</h1>
<form method=post action=\"$_SERVER[PHP_SELF]\">
<p><strong>Your E-Mail Address:</strong><br>
<input type=\"text\" name=\"post_owner\" size=40 maxlength=150>

<P><strong>Post Text:</strong><br>
<textarea name=\"post_text\" rows=8 cols=40 wrap=virtual></textarea>

<input type=\"hidden\" name=\"op\" value=\"addpost\">
<input type=\"hidden\" name=\"topic_id\" value=\"$topic_id\">

<P><input type=\"submit\" name=\"submit\" value=\"Add Post\"></p>

</form>
</body>
</html>";
}
} else if ($_POST["op"] == "addpost") {
//check for required items from form
if ((!$_POST["topic_id"]) || (!$_POST["post_text"]) ||
(!$_POST["post_owner"])) {
header("Location: topiclist.php");
exit;
}

//add the post
$add_post = "insert into forum_posts values ('', '$_POST[topic_id]',
'$_POST[post_text]', now(), '$_POST[post_owner]')";
mysql_query($add_post,$conn) or die(mysql_error());

//redirect user to topic

exit;
}
?>


Report this thread to moderator Post Follow-up to this message
Old Post
Remember14a@aol.com
09-29-04 02:26 AM


Re: error
On Tue, 28 Sep 2004 20:28, Remember14a@aol.com wrote:

> Dear friends,
>
> Script writes to database, however gives this error while on internet web
> server, on local host doesn't give same error.
>
> Any guidance, please
>
> Thank you
> -----------------------------------------
> Back to Main
> Notice: Undefined index: op in
>  \\premfs15\sites\premium15\mrbushforpeac
e\webroot\replytopost.php on line
> 9

You probably have different error_reporting settings in the php.ini files on
the different servers. Test if the value is set.

--
David Robley

"I commanded a group of ships for a w," Tom said fleetingly.

Report this thread to moderator Post Follow-up to this message
Old Post
David Robley
09-29-04 02:26 AM


RE: error
Suggestion, please note out where "line 9" is exactly.
Some mail clients will use wordwrap and some not so
the lines may not be the same on "every" mail client
so "line 9" could be more like "line 14" on some and
"line 9" on others.  Just "//comment" where "line 9"
is so we know and can answer your question alot
better/easier/faster. :)

Otherwise we would have to test and find ourself.
Which many of us don't have the time/patience for.

Jerry

-----------------------------

From: Remember14a@aol.com
Date: Tue, 28 Sep 2004 06:58:10 EDT
To: php-db@lists.php.net
Subject: error

Dear friends,

Script writes to database, however gives this error
while on internet
web
server, on local host doesn't give same error.

Any guidance, please

Thank you
-----------------------------------------
Back to Main
Notice: Undefined index: op in
 \\premfs15\sites\premium15\mrbushforpeac
e\webroot\replytopost.php
on
line 9
----------------------------------------------------------------------------
--
----
code of php script
----------------------------------------------------------------------------
--
----
<a href="www.abcdefg.us">Back to Main</a>

<?php
//connect to server and select database; we'll need it
soon
$conn = mysql_connect("orf-mysql1.brinkster.com",
"mrbushforpeace",
"poilkjmnb") or die(mysql_error());
mysql_select_db("mrbushforpeace",$conn)  or
die(mysql_error());

//check to see if we're showing the form or adding the
post
if ($_POST["op"] != "addpost") {
// showing the form; check for required item in
query string
if (!$_GET["post_id"]) {
header("Location: topiclist.php");
exit;
}

//still have to verify topic and post
$verify = "select ft.topic_id, ft.topic_title from
forum_posts as fp
left
join forum_topics as ft on fp.topic_id = ft.topic_id
where fp.post_id =
$_GET[post_id]";
$verify_res = mysql_query($verify, $conn) or
die(mysql_error());
if (mysql_num_rows($verify_res) < 1) {
//this post or topic does not exist
header("Location: topiclist.php");
exit;
} else {
//get the topic id and title
$topic_id =
mysql_result($verify_res,0,'topic_id');
$topic_title =
stripslashes(mysql_result($verify_res,
0,'topic_title'));

print "
<html>
<head>
<title>Post Your Reply in $topic_title</title>
</head>
<body>
<h1>Post Your Reply in $topic_title</h1>
<form method=post
action=\"$_SERVER[PHP_SELF]\">
<p><strong>Your E-Mail Address:</strong><br>
<input type=\"text\" name=\"post_owner\"
size=40 maxlength=150>

<P><strong>Post Text:</strong><br>
<textarea name=\"post_text\" rows=8 cols=40
wrap=virtual></textarea>

<input type=\"hidden\" name=\"op\"
value=\"addpost\">
<input type=\"hidden\" name=\"topic_id\"
value=\"$topic_id\">

<P><input type=\"submit\" name=\"submit\"
value=\"Add
Post\"></p>

</form>
</body>
</html>";
}
} else if ($_POST["op"] == "addpost") {
//check for required items from form
if ((!$_POST["topic_id"]) || (!$_POST["post_text"])
||
(!$_POST["post_owner"])) {
header("Location: topiclist.php");
exit;
}

//add the post
$add_post = "insert into forum_posts values ('',
'$_POST[topic_id]',
'$_POST[post_text]', now(), '$_POST[post_owner]')";
mysql_query($add_post,$conn) or die(mysql_error());

//redirect user to topic

exit;
}
?>



Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

Report this thread to moderator Post Follow-up to this message
Old Post
Jerry
09-29-04 09:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP DB archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:40 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.