View Full Version : Davidj Part9 complications

09-16-2008, 11:15 PM
I am trying to get my submit form working, and for the life of me, I cannot find where I am missing anything!
Please, anyone have any suggestions?

require_once("Connections/connection.php"); //database connection
$data2 = $_POST['data2'];
$data3 = $_POST['data3'];
$data4 = $_POST['data4'];
$submit = $_POST['submit'];
if ($submit && $data2 && $data3 && $data4){
$query = sprintf("INSERT into table1 (field2, field3, field4) values ('$data2', '$data3', '$data4')");
mysql_query($query)or die(mysql_error());

echo "still not there!";
$query =sprintf("SELECT * FROM table1");
$result =@mysql_query($query);
$row =mysql_fetch_array($result);

When I insert the text and hit submit, it does display my "echo" response, so, being a beginner, I know that from that point down in the script works ok.
I also know that the "require_once" section works, otherwise I would have no form showing up in the first place. So, what am I doing wrong?

TheNewTag. Daniel.

09-17-2008, 01:05 AM
are these the actual names of your fields
table1 (field2, field3, field4

09-17-2008, 09:44 PM
Yes, those are my field names. I did it just like the tutorial shows, therefore, beside the name of the document (practice.php instead of dwc.php), everything should be identical.

09-17-2008, 10:19 PM
I also just now went ahead and did the next tutorial (Part10) and everthing has been typed the same. When I went to look at the 'source code' for the page like david shows in his tutorial, I get a blank page. This could be a symptom of my problem. I don't know; just thought it might help.

09-18-2008, 06:04 AM
($submit && $data2 && $data3 && $data4){

if these are set then your code should run. If you are echoing your warning then one of the above is not being set. You need to echo each variables
to see whats in them.

09-18-2008, 10:09 PM
The solution was found when I noticed that I forgot the '=' in the coding that was placed in the html portion. I didn't place the "onClick" equal sign, and when I selected the text and copied it again to update, the mistake was carried over. I couldn't update or delete, and now I can.

<input type="button" name="button2" value="Update" onClick="document.location.href='practice.php?upd=<?php echo $row['field1_id']?>'"/>
<td height="27"><?php echo $row['field1_id'];?></td>

I am now doing the login tutorials. Everything works great. BTW, David, your tutorials are AWESOME! I was able to understand everything as I went.

I am stuck on the last part. The Logoff works, but when I try to do the security portion, it tells me that "includes/security.php" isn't there. And yes, I did double and triple check. Everything is spelled correctly.

At first, all it did was keep going back to the login page, as if I was trying to enter the welcom.php without permission. Then I tried typing in the whole path


This took me to the welcome page, but told me that the file wasn't there...


09-19-2008, 05:42 AM
post your code