logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-10-2007, 12:07 AM   #1
MarkDakers
 
Join Date: Mar 2007
Posts: 4
Default $_SERVER[PHP_SELF] debug needed please

Hi

I'm following the PHP tutorials. I'm a bit stuck on Tutorial 10. Everything works until I hit submit, then I just get Error 404 Page not found! Everything up to this pointbworks fine. Bet it's easy to spot from "outside" but I'm failing!

Code:

PHP Code:
<?PHP
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());
 
}elseif(
$submit) {
echo 
"One of your fields is empty!";
}
 
 
$query sprintf("SELECT * FROM table1");
$result mysql_query($query);
$row mysql_fetch_array($result);
 
 
 
 
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<p>&nbsp;</p>
 
 
<form id="form1" method="post" action="<?php $_SERVER['PHP_SELF']; ?> ">
 
 
<table width="75%" border="1">
<tr> 
<td>data1</td>
<td>data2</td>
<td>data3</td>
</tr>
<tr> 
<td><input name="data1" type="text" id="data1"></td>
<td><input name="data2" type="text" id="data2"></td>
<td><input name="data3" type="text" id="data3"></td>
</tr>
<tr> 
<td colspan="3"><div align="center">
<input type="submit" name="Submit" value="Submit">
<input name="submit" type="hidden" id="submit" value="1">
</div></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="75%" border="1">
<tr>
<td>ID_1</td>
<td>data2</td>
<td>data3</td>
<td>data4</td>
</tr>
 
<?php do { ?>
 
 
<tr>
<td><?php echo $row["field1_id"];?></td>
<td><?php echo $row["field2"];?></td>
<td><?php echo $row["field3"];?></td>
<td><?php echo $row["field4"];?></td>
</tr>
 
<?php } while ($row mysql_fetch_array($result)); ?>
 
</table>
 
</body>
</html>
All help appreciated.

If anyone has a set of finished code - I'd love to see it.

Mark
MarkDakers is offline   Reply With Quote
Old 03-10-2007, 05:18 PM   #2
lux
 
Join Date: Apr 2006
Posts: 313
Default

you'll find a working example in this thread

http://www.dreamweaverclub.com/forum...ad.php?t=25153

give me a shout if you still have problems
__________________
"i was going to say that!" - davidj 2008
lux is offline   Reply With Quote
Old 03-10-2007, 06:05 PM   #3
MarkDakers
 
Join Date: Mar 2007
Posts: 4
Smile Solved it!

I have miss-labelled variables / form object ids.

$data2,$data3,$data4

then in the form I numbered data1, data2 and data3

There was also a closing chevron.

I'm really chuffed with my progress; a huge thanks to the forum, especially dj, marvellous stuff.
MarkDakers is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:32 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com