veronika Posted February 22, 2010 Share Posted February 22, 2010 When I submit my .html form to talk to my .php i get awebpage not found error message. Can someone please look at the script and let me know what is missing/wrong. I've checked like over and over again and I can't seem to get it. HTML: <HTML> <HEAD> <TITLE>Assignment: Lab #8</TITLE> </HEAD> <BODY> <H1>Records added to Estimates</H1> <FORM METHOD="POST" ACTION="solution08 .php"> <TABLE CELLSPACING = 8 CELLPADDING = 10 > <TR> <TD VALIGN = TOP> <P><strong>BUDGET:</strong><BR> <INPUT TYPE = "text" NAME = "budget" SIZE=15 MAXLENGTH=15></P> <TD VALIGN = TOP> <P><STRONG>CATEGORY (Select One):</STRONG><BR> <select> <option>Credit Card</option> <option>Check</option> <option>Cash</option> </select> </P> </TD> </TR> <TR> <TD VALIGN = TOP COLSPAN = 2 ALIGN = LEFT> <P><Strong>DESCRIPTION</strong>:<BR> <TEXTAREA NAME = "description" COLS=35 ROWS=5 WRAP=virtual></TEXTAREA></P> <P><INPUT TYPE = "submit" NAME = "submit" VALUE ="Add Record"></P> </TD> </TR> </TABLE> </FORM> </BODY> </HTML> .PHP: <? if ((!$_POST['budget']) || (!$_POST['category']) || (!$_POST['description'])) { header( "Location: solution08 .html"); exit; } $dbhost = 'localhost'; $dbuser = 'spike'; $dbpwd = '9sj7En4'; $conn=mysql_connect($dbhost,$dbuser,$dbpws) or die (mysql_error()); $dbname = 'homebudget'; $table_name = 'estimates'; mysql_select_db($dbname); $budget = mysql_escape_string (!$_POST['budget']); $category = mysql_escape_string (!$_POST['category']); $description = mysql_escape_string (!$_POST['description']); $sql = "INSERT INTO $table_name (budget, category, description) VALUES ('$budget', '$category', '$description')"; $result = mysql_query($sql, $connection) or die(mysql_error()); ?> <HTML> <HEAD> <TITLE>Assignment: Lab #8</TITLE> </HEAD> <BODY> <H1>Added Record <? echo "$table_name"; ?></H1> <TABLE CELLSPACING=5 CELLPADDING=5> <TR> <TD VALIGN=TOP> <P><STRONG>Budget:</STRONG><BR> <? echo "$budget";?></P> <P><STRONG>Category:</STRONG><BR> <? echo "$category"; ?></P> </TD> <TR> <TD VALIGN=TOP COLSPAN=2 ALIGN=CENTER> <P><STRONG>Description:</STRONG><BR> <? echo stripslashes("$description"); ?></P> <P><a href = "solution08 .html">Add Another</a></P> </TD> </TR> </TABLE> </BODY> </HTML> Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/ Share on other sites More sharing options...
ultraloveninja Posted February 22, 2010 Share Posted February 22, 2010 are your html and php files saved in the same directory? Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015862 Share on other sites More sharing options...
veronika Posted February 22, 2010 Author Share Posted February 22, 2010 yes...they're both saved under the document root of my web server Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015865 Share on other sites More sharing options...
ultraloveninja Posted February 22, 2010 Share Posted February 22, 2010 I don't know what editor you are using, but where it says this: <FORM METHOD="POST" ACTION="solution08 .php"> Is it all on one line like this: <FORM METHOD="POST" ACTION="solution08.php"> Usually when you get a "Page cannot be found" error it usually means that when you submit your form it looks for the solution08.php but it cannot find it. Is it possible for you to post the exact error? Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015873 Share on other sites More sharing options...
The Eagle Posted February 22, 2010 Share Posted February 22, 2010 Yes, <FORM METHOD="POST" ACTION="solution08 .php"> If this is on your editor, you have an issue change it to <form method="POST" action="solution08.php"> If your issue continues to occur, please copy and paste the URL in your web-address bar you redirect to when you fill out the HTML form. Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015875 Share on other sites More sharing options...
veronika Posted February 22, 2010 Author Share Posted February 22, 2010 That line is all in one...for some reason when i post it here it separated. Now, I named the file solution08 .php Do you think the part has something to do with it? It won't let me post the error...sorry Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015884 Share on other sites More sharing options...
ultraloveninja Posted February 22, 2010 Share Posted February 22, 2010 you can't copy and paste what the browser says when it errors out? Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015891 Share on other sites More sharing options...
jcanker Posted February 22, 2010 Share Posted February 22, 2010 A few things, just so we're not making any assumptions: 1) Do your other php files work properly on that server? 2) What happens when you try to go to solution08.php directly in the url? Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015893 Share on other sites More sharing options...
jorley Posted February 22, 2010 Share Posted February 22, 2010 Just to rule some stuff out. I noticed that you don't have any 'name' in the category drop down. Presumably this should be called 'category' based on the process of elimination from your posts. This is triggering the redirect at the beginning of the php page which is also separating the solution08 and .php. Make sure they are put together. Lastly, and this might now be anything but lets rule it out, can you change the html page to .php just to see what happens? Quote Link to comment https://forums.phpfreaks.com/topic/192871-my-html-php-wont-talkhelp/#findComment-1015900 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.