Hi,
I had this code working perfectly, before tampering with it with the vb forum info, now it wont work.
All I want it to do is to pull the users username and place it in the 'act' field. I've managed to do this, as you can see it on the page, but once i submit it, it only submits the 'title' field to the forum, none of the rest, is there any reason why this might be?
I had this code working perfectly, before tampering with it with the vb forum info, now it wont work.
All I want it to do is to pull the users username and place it in the 'act' field. I've managed to do this, as you can see it on the page, but once i submit it, it only submits the 'title' field to the forum, none of the rest, is there any reason why this might be?
PHP Code:
<?php
chdir('/home/uraps08/public_html/promote');
require_once('/home/uraps08/public_html/promote/global.php');
$username = $vbulletin->userinfo['username'];
?>
<!-- HTML page header goes here -->
<span class="title">My Uraps - Submit A Release</span><br />
<?php
//form not yet submitted
//display add news form
if (!$_POST['submit'])
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="400" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="right" nowrap="nowrap"><strong>Act Name:</strong></td>
<td><input name="act" type="text" value="<?php echo $username; ?>" readonly size="50" maxlength="250" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><strong>Release Title:</strong></td>
<td><input size="50" maxlength="250" type="text" name="title" /></td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><strong>Release Type:</strong></td>
<td>
<select name="type"><br />
<option value="" selected>Select From List</option>
<option value="1">Single</option>
<option value="2">Album</option>
</select>
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><strong>Release Date:</strong></td>
<td>
<?php
chdir('/home/uraps08/public_html');
include('includes/config.php');
include('includes/functions.php');
//Open a connection to the database
$db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
mysql_select_db($name) or die ('Error connecting to mysql');
//generate and execute the sql query
$query = "SELECT * FROM $release_date_db ORDER BY date ASC";
$result = mysql_query($query)
or die ("Error in query: $query. " . mysql_error());
//echo the drop down menu
echo "<select name=\"release_date\"><br>";
echo "<option value=\"\">Select From List</option>";
//if records are present
if (mysql_num_rows($result) > 0)
{
//iterate through results
//print title and links to edit and delete
while ($row = mysql_fetch_object($result))
{
?>
<option value="<?php echo $row->date; ?>"><?php echo formatDate($row->date); ?></option>
<?php
}
//echo the closing tag for drop down menu
}
echo "</select><br />";
?>
</td>
</tr>
<tr>
<td align="right" nowrap="nowrap"><strong>Taken From:</strong></td>
<td>
<select name="taken_from">
<option value="current">Current Album</option>
<option value="forthcoming">Forthcoming Album</option>
<option value="one off">One off Single</option>
</select>
</td>
</tr>
<tr>
<td align="right"> </td>
<td><input type="Submit" name="submit" value="Add Release" /></td>
</tr>
</table>
</form>
<?php
}
else
{
chdir('/home/uraps08/public_html');
include('includes/config.php');
include('includes/functions.php');
//set up error list
$errorList = array();
$title = $_POST['title'];
$content = $_POST['type'];
$contact = $_POST['release_date'];
//validate text input fields
if (trim($_POST['title']) == '')
{
$errorList[] = 'Invalid title';
}
if (trim($_POST['type']) == '')
{
$errorList[] = 'Invalid release type';
}
if (trim($_POST['release_date']) == '')
{
$errorList[] = 'You have failed to select a release date.';
}
//check for errors
//if none are found...
if (sizeof($errorList) == 0)
{
//Open a connection to the database
$db = mysql_connect($hostname, $user, $pass) or die ('Error connecting to mysql');
mysql_select_db($name) or die ('Error connecting to mysql');
/**
act
title
type
release_date
taken_from
*/
//generate and execute query
chdir('/home/uraps08/public_html');
$query = "INSERT INTO $release_sched_db(act, title, type, release_date, taken_from) VALUES('$act', '$title', '$type', '$release_date', '$taken_from')";
$result = mysql_query($query)
or die ("Error in query: $query. " . mysql_error());
//print result
echo '<font size="-1">Your release has been added... <a href="releases.php">Go to the release schedule...</a>.</font>';
//close the database connection
mysql_close($db);
}
else
{
//errors found
//print a list
echo '<font size="-1">The following errors were found:';
echo '<br />';
echo '<ul>';
for ($x=0; $x<sizeof($errorList); $x++)
{
echo "<li>$errorList[$x]";
}
echo '</ul></font>';
}
}
?>
<!-- HTML page footer -->
Comment