Im not sure how to do that, I have tried to set the display_errors to On on the php.ini files but it didnt seem to make any difference.
This is what im trying to fix: sorry i cant attach it.
<html>
<head>
<title>Add an Article</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<?php
// Get the PHP file containing the DbConnector class
require_once('../includes/DbConnector.php');
require_once('../includes/Validator.php');
// Create an instance of DbConnector
$connector = new DbConnector();
// Check whether a form has been submitted. If so, carry on
if ($HTTP_POST_VARS){
// Validate the entries
$validator = new Validator();
$validator->validateTextOnly($HTTP_POST_VARS['title'],'Title');
$validator->validateTextOnly($HTTP_POST_VARS['imgDescrip'],'ImageDes');
$validator->validateNumber($HTTP_POST_VARS['Section'],'Section');
$validator->validateGeneral($HTTP_POST_VARS['mainText'],'MainText');
// Check whether the validator found any problems
if ( $validator->foundErrors() ){
echo 'There was a problem with: <br>'.$validator->listErrors('<br>'); // Show the errors, with a line between each
}else{
// Create an SQL query (MySQL version)
// The 'addslashes' command is used 5 lines below for added security
// Remember to use 'stripslashes' later to remove them (they are inserted in front of any
// special characters
$insertQuery = "INSERT INTO project_content (Title,MainText,Image,ImageDes,Section) VALUES (".
"'".$HTTP_POST_VARS['title']."', ".
"'".addslashes($HTTP_POST_VARS['mainText'])."', ".
$HTTP_POST_VARS['image']."', ".
$HTTP_POST_VARS['imgDescrip']."', ".
"'".$HTTP_POST_VARS['section']."')";
// Save the form data into the database
if ($result = $connector->query($insertQuery)){
// It worked, give confirmation
echo '<center><b>Content added to the project database</b></center><br>';
}else{
// It hasn't worked so stop. Better error handling code would be good here!
exit('<center>Sorry, there was an error saving to the database</center>');
}
}
}
?>
<html>
<head>
<title> Add/Modify project content </title>
</head>
<body>
<h2> Form to Add / Modify Content </h2>
<form name="input1" method ="post" action="AddContent.php">
<table>
<tr>
<td> Title: </td>
<td><input type="text" name="title" size="50"></td></tr>
<tr><td> Section: </td>
<td><input type="int" name="Section" size="4"></td></tr>
<tr>
<td> Main Text: </td>
<td><textarea rows="5" cols="37"" name="mainText">
</textarea></td></tr>
<tr>
<td>Load Image: </td>
<td><input type="file" name="image"></td></tr>
<td>Image Position
<table>
<tbody>
<tr>
<td align=center><input type=radio name=position value=topleft ></td>
<td align=center><input type=radio name=position value=top ></td>
<td align=center><input type=radio name=position value=topright ></td>
</tr>
<tr>
<td><input type=radio name=position value=left ></td>
<td>text</td>
<td><input type=radio name=position value=right ></td>
</tr>
<tr>
<td align=center><input type=radio name=position value=botleft ></td>
<td align=center><input type=radio name=position value=bot checked></td>
<td align=center><input type=radio name=position value=botright ></td>
</tr>
</tbody>
</table></td>
<tr>
<td>Image Description: </td>
<td><input type="text" name="imgDescrip" size="50"></td>
</tr>
<tr>
<td>More Images: </td></tr>
<br>
<tr>
<td> Place Links: <small>(Upload a file)</small></td>
<td> <input type="file" name="file"></td>
</tr><table>
<p align="center">
<input type="submit" value="Submit">
</p>
</form>
</body>
</html>
Previously the following test worked:
<?php
// Get the PHP file containing the DbConnector class
require_once('DbConnector.php');
// Create an instance of DbConnector
$connector = new DbConnector();
// Use the query function of DbConnector to run a database query
// (The arrow -> is used to access a function of an object)
$result = $connector->query('SELECT firstname FROM customers');
// Get the result
$row = $connector->fetchArray($result);
// Show it to the user
echo $row['firstname'];
?>
but it doesnt display anything at all now.
Cheers mate.