View Full Version : Just a blank screen

03-18-2008, 07:19 PM
I am wanting to make a database app. Very simple. I just need to be able to enter information into a database, delete it and show it.

I've gotten the show part.

I am working on the insert part and I am stuck. I have a very simple HTML form with about 9 fields.

I am using a MS Access database and PHP.

This is my processing file:


if ( !( $database = odbc_connect( "Warranty", "","")))
die( "Could not connect to database" );

$stmt = odbc_prepare($database, "INSERT INTO WarrantyInformation (Requester, Owner, MakeModel, SerialNo, Received, Shipped, TicketNo, Notes) VALUES('$requester','$owner', '$makemodel', '$serialno', '$received', '$shipped', '$ticketno', '$notes');" );

if (!odbc_execute( $stmt))


echo "Whoops";


When I go to the form page and fill it in and click SUBMIT, I get a blank page and the DB is not updated. If I turn on the Friendly Warning in IE it just gets me a 500 Internal Server error.

I am using Xitami as the webserver and it processes other PHP stuff just fine. What am I doing wrong?



03-18-2008, 07:29 PM
You need to put a ';' at the end of your variables that are set to the posted data.
sooo like this,


Also i duno if its just you havent included it, but the closing ?> php tag. Duno just a suggestion

03-19-2008, 12:12 PM
When I run the code below, I get the next autonumber in the DB, but there is no data in there. I've rechecked all my variables and I can't see anything wrong. It just writes blanks and then autonumbers. What am I missing?

Here is my HTML Form:

<FORM action="insertintodb.php" method="post">
Requester: <input type="text" name="requester"></br>
Owner:<input type="text" name="owner"></br>
Make/Model:<input type="text" name="makemodel"></br>
Serial Number:<input type="text" name="serialno"></br>
Received:<input type="text" name="received"></br>
Shipped:<input type="text" name="shipped"></br>
Ticket Number:<input type="text" name="ticketno"></br>
Notes/Commnets:<input type="text" name="notes"></br>
<input type="Submit" name="Enter"><input type="reset"></br>

and here is the PHP:


if ( !( $database = odbc_connect( "Warranty", "","")))
die( "Could not connect to database" );

$stmt = odbc_prepare($database, "INSERT INTO WarrantyInformation (Requester, Owner, MakeModel, SerialNo, Received, Shipped, TicketNo, Notes) VALUES('$requester','$owner', '$makemodel', '$serialno', '$received', '$shipped', '$ticketno', '$notes');" );

if (!odbc_execute( $stmt))


echo "Whoops";



03-19-2008, 12:14 PM
Thanks! That was it.

I SHOULD have seen that! :mad:

That got it working, somewhat anyway. I have a new post about now the Access DB will autonumber but no data is inserted. If you can help, please do. I can't see anything wrong with the code.

03-19-2008, 01:55 PM
<FORM action="insertintodb.php" method="post">
Requester: <input type="text" name="requester" value=""></br>
Owner:<input type="text" name="owner" value=""></></br>
Make/Model:<input type="text" name="makemodel" value=""></></br>
Serial Number:<input type="text" name="serialno" value=""></></br>
Received:<input type="text" name="received" value=""></></br>
Shipped:<input type="text" name="shipped" value=""></></br>
Ticket Number:<input type="text" name="ticketno" value=""></></br>
Notes/Commnets:<input type="text" name="notes" value=""></></br>
<input type="Submit" name="Enter"><input type="reset"></br>

insert value into your form




03-19-2008, 03:21 PM
Anytime :D i made a simple mistake of leaving out an equals in html and when you send that through it doesnt work....we all do it.

Think boogyman got there before i did. He seems to have it cracked, thats what i would have suggested.

03-19-2008, 03:35 PM
Thank you! That got it working wonderfully.

If you don't mind me asking another basic question.

How would I add links on my output page that would allow deleting of records?

Here is that page:

if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT * FROM WarrantyInformation";
if (!$rs)
{exit("Error in SQL");}
echo "<table border=1>";
echo "<tr><th>Requester</th>";
echo "<th>Owner</th>";
echo "<th>Make/Model</th>";
echo "<th>Serial Number</th>";
echo "<th>Recieved</th>";
echo "<th>Shipped</th>";
echo "<th>Ticket Number</th>";
echo "<th>Notes/Comments</th></tr>";

while (odbc_fetch_row($rs))
echo "<tr><td>$requester</td>";
echo "<td>$owner</td>";
echo "<td>$makemodel</td>";
echo "<td>$serialno</td>";
echo "<td>$received</td>";
echo "<td>$shipped</td>";
echo "<td>$ticketno</td>";
echo "<td>$notes</td></tr>";

echo "</table>";

03-19-2008, 03:59 PM
same way you assign any other links, however this would need extra security to be sure that the person has the correct level of administrative access to perform this deletion action. the only way to "undo" a delete is from a backup, which means dumping your database.

you assign the link to an anchor tag and use a get variable to assign the exact record you wish to delete,and once clicked, that script would perform a query to delete the record

DELETE FROM table WHERE condition;

03-19-2008, 04:47 PM
Thanks again!

The page that will contain that will be password protected.

Thanks for all the help. I am almost done.

So, the command will be "DELETE FROM WarrantyInformation WHERE Requester =".$_POST['Requester']";

How would I just delete the entire record? Would I need to refer to it by the autonumer or something like that?

The link itself is: <a ... umm...!! STUCK AGAIN! :mad:

Looked around on Google but I can't see to find anything that explains it.

03-19-2008, 05:43 PM
delete syntax

two helpful references are
PHP Reference Manual - http://php.net
MySQL Reference Manual - http://dev.mysql.com/doc/refman/5.0/en/

03-19-2008, 06:25 PM