Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

I can't think of a good title, so my threads get locked

Recommended Posts

Uhh this is very not cool, I have one of my largest pages, after I finished programming it, it gave me a $ at end of file warning.  This means I left  a ; out somewhere a $ out somewhere, or misaligned braces, can you see anything, I have went over it 6-7 times.
[code]<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include '../includes/meta.inc.php'; // includes meta tags, stylesheet, and javascript inclusion
?>
</head>
<body>
<div id="wrap">
<?php
include '../includes/header.inc.php'; // inserts header, logo, and everything up there
?>
    <br style="clear: both;" />

<?php
include '../includes/leftnav.inc.php'; // inserts left navigation
?>

    <div id="content">

        <div class="overall">
<h3>Ad Posting Process</h3>
<?php
// connecting to database, selecting database
mysql_connect("mysql185.secureserver.net", "######", "####");
mysql_select_db("joyel");
// This is the final process basically. Only run these queries if it's recieving a special post
// which would be variable named command, value set to yes.  Upon seeing this, then take the proper post information from post, and update the database accordingly.
if ($_POST['command'] == "yes") {
// basic universal variables
$postset = mysql_real_escape_string($_POST['postset']);
$postid = mysql_real_escape_string($_POST['postid']);
$userid = mysql_real_escape_string($_POST['userid']);
switch ($postset) {
case "postset1":
$itemtitle = mysql_real_escape_string($_POST['itemtitle']);
$price = mysql_real_escape_string($_POST['price']);
$description = mysql_real_escape_string($_POST['description']);
$zipcode = mysql_real_escape_string($_POST['zipcode']);
$update = "UPDATE $postset SET itemtitle = '$itemtitle', price = '$price', description =
'$description', zipcode = '$zipcode' WHERE postid = '$postid' AND userid = '$userid';";
if (mysql_query($update)) {
echo "Your post was successfully updated.<br />";
}else {
echo "There was some sort of issue updating your post.<br />";
echo "Please try again or contact support.<br />";
}
break;

case "postset2":
break;

case "postset3":
break;

case "postset4":
break;

case "postset5":
break;

case "postset6":
break;

case "postset7":
break;

case "postset8":
break;

}

//  Prepare variables to work with db
// act on variables accordingly.
if ($_POST['postset']) {
$postset = mysql_real_escape_string($_GET['postset']);
$postid = mysql_real_escape_string($_GET['postid']);
$userid = mysql_real_escape_string($_GET['userid']);
}elseif ($_GET['postset']) {
$postset = mysql_real_escape_string($_GET['postset']);
$postid = mysql_real_escape_string($_GET['postid']);
$userid = mysql_real_escape_string($_GET['userid']);
}
switch ($postset) {
case "postset1":
$selectps1 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps1 = mysql_query($selectps1);
if ($row1 = mysql_fetch_array($queryps1)) {
?>
<form  name="post1" id="post1" action="post4.php" method="post">
<label for="itemtitle">*Item Title:</label><br />
<input name="itemtitle" id="itemtitle" type="text" maxlength="120"
value="<?php echo $row1['itemtitle']; ?>" /><br />
<label for="price">Price:</label><br />
<input name="price" id="price" type="text" maxlength="100"
value="<?php echo $row1['price']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row1['zipcode']; ?>" /><br />
<label for="description">*Description:</label><br />
<textarea name="description" id="description" rows="10"
cols="30"><?php echo $row1['description']; ?></textarea><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset2":
$selectps2 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps2 = mysql_query($selectps2);
if ($row2 = mysql_fetch_array($queryps2)) {
?>
<form name="post2" id="post2" action="post4.php" method="post">
<label for="itemtitle">*Item Title:</label><br />
<input name="itemtitle" id="itemtitle" type="text" maxlength="200"
value="<?php echo $row2['itemtitle']; ?>" /><br />
<label for="reward">Reward:</label><br />
<input name="reward" id="reward" type="text" maxlength="120"
value="<?php echo $row2['reward']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row2['zipcode']; ?>" /><br />
<label for="datelost">Date Lost:</label><br />
<input name="datelost" id="datelost" type="text" maxlength="120"
value="<?php echo $row2['datelost']; ?>" /><br />
<label for="locationlost">Location Lost:</label><br />
<input name="locationlost" id="locationlost" type="text" maxlength="120"
value="<?php echo $row2['locationlost']; ?>" /><br />
<label for="description">*Description:</label><br />
<textarea name="description" id="description" rows="10"
cols="30"><?php echo $_GET['description']; ?></textarea><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset3":
$selectps3 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps3 = mysql_query($selectps3);
if ($row3 = mysql_fetch_array($queryps3)) {
?>
<form name="post3" id="post3" action="post4.php" method="post">
<label for="itemtitle">*Item Title:</label><br />
<input name="itemtitle" id="itemtitle" type="text" maxlength="200"
value="<?php echo $row3['itemtitle']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row3['zipcode']; ?>" /><br />
<label for="datefound">Date Found:</label><br />
<input name="datefound" id="datefound" type="text" maxlength="120"
value="<?php echo $row3['datefound']; ?>" /><br />
<label for="locationfound">Location Found:</label><br />
<input name="locationfound" id="locationfound" type="text" maxlength="120"
value="<?php echo $row3['locationfound']; ?>" /><br />
<label for="description">*Description:</label><br />
<textarea name="description" id="description" rows="10"
cols="30"><?php echo $row3['description']; ?></textarea><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset4":
$selectps4 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps4 = mysql_query($selectps4);
if ($row4 = mysql_fetch_array($queryps4)) {
?>
<form name="post4" id="post4" action="post4.php" method="post">
<label for="itemtitle">*Item Title:</label><br />
<input name="itemtitle" id="itemtitle" type="text" maxlength="200"
value="<?php echo $row4['itemtitle']; ?>" /><br />
<label for="priceperunit">Price Per Unit:</label><br />
<input name="priceperunit" id="priceperunit" type="text" maxlength="120"
value="<?php echo $row4['priceperunit']; ?>" /><br />
<label for="numberofunits">Number Of Units:</label><br />
<input name="numberofunits" id="numberofunits" type="text" maxlength="120"
value="<?php echo $row4['numberofunits']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row4['zipcode']; ?>" /><br />
<label for="description">*Description:</label><br />
<textarea name="description" id="description" rows="10"
cols="30"><?php echo $row4['description']; ?></textarea><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset5":
$selectps5 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps5 = mysql_query($selectps5);
if ($row5 = mysql_fetch_array($queryps5)) {
?>
<form name="post5" id="post5" action="post4.php" method="post">
<label for="itemtitle">*Item Title:</label><br />
<input name="itemtitle" id="itemtitle" type="text" maxlength="200"
value="<?php echo $row5['itemtitle']; ?>" /><br />
<label for="wage">Wage:</label><br />
<input name="wage" id="wage" type="text" maxlength="120"
value="<?php echo $row5['wage']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row5['zipcode']; ?>" /><br />
<label for="description">*Description:</label><br />
<textarea name="description" id="description" rows="10"
cols="30"><?php echo $row5['description']; ?></textarea><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset6":
$selectps6 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps6 = mysql_query($selectps6);
if ($row6 = mysql_fetch_array($queryps6)) {
?>
<form name="post3" id="post3" action="post4.php" method="post">
<label for="itemtitle">*Item Title:</label><br />
<input name="itemtitle" id="itemtitle" type="text" maxlength="200"
value="<?php echo $row6['itemtitle']; ?>" /><br />
<label for="wage">Wage:</label><br />
<input name="wage" id="wage" type="text" maxlength="120"
value="<?php echo $row6['wage']; ?>" /><br />
<label for="hoursperweek">Hours Per Week:</label><br />
<input name="hoursperweek" id="hoursperweek" type="text" maxlength="120"
value="<?php echo $row6['wage']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row6['zipcode']; ?>" /><br />
<label for="description">*Description:</label><br />
<textarea name="description" id="description" rows="10"
cols="30"><?php echo $row6['description']; ?></textarea><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset7":
$selectps7 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps7 = mysql_query($selectps7);
if ($row7 = mysql_fetch_array($queryps7)) {
?>
<form name="post3" id="post3" action="post4.php" method="post">
<label for="coursenumber">Course Number:</label><br />
<input name="coursenumber" id="coursenumber" type="text" maxlength="120"
value="<?php echo $row7['coursenumber']; ?>" /><br />
<label for="title">*Title:</label><br />
<input name="title" id="title" type="text" maxlength="200"
value="<?php echo $row7['title']; ?>" /><br />
<label for="author">*Author:</label><br />
<input name="author" id="author" type="text" maxlength="120"
value="<?php echo $row7['author']; ?>" /><br />
<label for="price">Price:</label><br />
<input name="price" id="price" type="text" maxlength="120"
value="<?php echo $row7['price']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row7['zipcode']; ?>" /><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break;
case "postset8":
$selectps8 = "SELECT * FROM $postset WHERE postid = '$postid' AND userid = '$userid';";
$queryps8 = mysql_query($selectps8);
if ($row8 = mysql_fetch_array($queryps8)) {
?>
<form name="post3" id="post3" action="post4.php" method="post">
<label for="coursenumber">*Course Number:</label><br />
<input name="coursenumber" id="coursenumber" type="text" maxlength="120"
value="<?php echo $row8['coursenumber']; ?>" /><br />
<label for="test">Test:</label><br />
<input name="test" id="test" type="text" maxlength="200"
value="<?php echo $row8['test']; ?>" /><br />
<label for="professor">Professor:</label><br />
<input name="professor" id="professor" type="text" maxlength="200"
value="<?php echo $row8['professor']; ?>" /><br />
<label for="zipcode">Zipcode:</label><br />
<input name="zipcode" id="zipcode" type="text" maxlength="30"
value="<?php echo $row8['zipcode']; ?>" /><br />
<input name="postset" type="hidden" value="<?php echo $postset; ?>" />
<input name="postid" type="hidden" value="<?php echo $postid; ?>" />
<input name="userid" type="hidden" value="<?php echo $userid; ?>" />
<input name="command" type="hidden" value="yes" />
<input name="submit" id="submit" type="submit" value="submit" />
</form>
<?php
}
break; // last break
} // end total switch
?>
        </div>

    </div>
<?php
include '../includes/banner.inc.php'; // includes the banner, randomly selected from a database
?>

<?php
include '../includes/footer.inc.php'; // includes the page footer, bottom navigation copyright
?>
</div>
</body>
</html>[/code]

Share this post


Link to post
Share on other sites
I would say you have left out a closing brace. I use php edit you can select the first brace and it will high light in red the second. You can then check which ones missing  which will be easyier than me checking here without

Share this post


Link to post
Share on other sites
ya know what businessman?  You've been here long enough to know that "uhh... help" is NOT a valid thread title.  Thread closed!

Share this post


Link to post
Share on other sites
[code]if ($_POST['command'] == "yes") {      // <---  has no matching '}'[/code]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.