Pages: 12Next
Current Page: 1 of 2
HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 01:20PM

Hi,

I just installed WampServer2.0c yesterday and it works fine, but I have a problem when I try to submit forms.

I have a very basic HTML form. When I click on submit, the HTML form requests the PHP file. Rather than process the file then post it back to Explorer7, it asks me to open or save the PHP file in Dreamweaver.

There is nothing wrong with the HTML form as I have the source code from a books CD too. I think it must be something to do with my WampServer settings.

I don't know if I should uninstall WampServer and install everything seperately.

Any ideas?

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: yfastud (Moderator)
Date: November 26, 2008 01:57PM


Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 02:10PM

Hey thanks for the quick reply. I just tried it with short_open_tags on, then restarted the Wamp services, but it made no difference. :-(

I'm running Windows Vista 64 Ultimate.

I tried to change file accociation, but it made no difference confused smiley

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: yfastud (Moderator)
Date: November 26, 2008 02:29PM

try to run it w/o dreamweaver to see if having same problem

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 02:51PM

I don't think it's anything to do with Dreamweaver, because when I associate .php files with Notepad, it asks me to open Notepad rather than Dreamweaver.

The first HTML form works fine. All PHP files work fine. The problem starts when I submit my HTML form and a request is made for a PHP file that will process the HTML form input. Rather than just run the php file, Windows asks me to open the PHP file using an application program like Dreamweaver/Notepad. confused smiley



Edited 1 time(s). Last edit at 11/26/2008 02:54PM by Topkat.

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: yfastud (Moderator)
Date: November 26, 2008 03:08PM


Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 03:28PM

This is the html form called orderform.html
--------
<html>
<head><title>Bob's Auto Parts</title></head>
<body>
<form action="processorder.php" method="post">
<table border="0">
<tr bgcolor="#cccccc">
<td width="150">Item</td>
<td width="15">Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align="center"><input type="text" name="tireqty" size="3"
maxlength="3" /></td>
</tr>
<tr>
<td>Oil</td>
<td align="center"><input type="text" name="oilqty" size="3"
maxlength="3" /></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align="center"><input type="text" name="sparkqty" size="3"
maxlength="3" /></td>
</tr>
<tr>
<td>How did you find Bob's?</td>
<td><select name="find">
<option value = "a">I'm a regular customer</option>
<option value = "b">TV advertising</option>
<option value = "c">Phone directory</option>
<option value = "d">Word of mouth</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit Order" /></td>
</tr>
</table>
</form>
</body>
</html>

------


And below is the php file (processorder.php) which should process the HTML order form.

-----------

<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
echo '<p>Order processed at ';
echo date('H:i, jS F');
echo '</p>';
echo '<p>Your order is as follows: </p>';
echo $tireqty.' tires<br />';
echo $oilqty.' bottles of oil<br />';
echo $sparkqty.' spark plugs<br />';

$totalqty = 0;
$totalamount = 0.00;

$totalqty = 0;
$totalqty = $tireqty + $oilqty + $sparkqty;
echo 'Items ordered: '.$totalqty.'<br />';

$totalamount = 0.00;

define('TIREPRICE', 100);
define('OILPRICE', 10);
define('SPARKPRICE', 4);

$totalamount = $tireqty * TIREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;

echo 'Subtotal: $'.number_format($totalamount,2).'<br />';

$taxrate = 0.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
echo 'Total including tax: $'.number_format($totalamount,2).'<br />';

?>
</body>
</html>

----------

It should work fine as I got it from a books CD...

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: stevenmartin99 (193.120.116.---)
Date: November 26, 2008 03:51PM

are you sure its from a book? Cos there is code missing like $_POST

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 04:11PM

Yeah I pulled it straight from the CD "PHP and MySQL Web Development 4th Edition". I copied the example which gave me the same problem, then I got the CD version which gave me the SAME problem.

[www.amazon.co.uk]

I changed {method="post"} to {method="$_POST"} and it didn't ask me to open Dreamweaver!!! :-)

But I got a load of errors! I'll figure out how to fix them soon.

Thanks a lot guys!!! Now I know there is nothing wrong with my Wampserver!!! :-)))

Maybe I should invest in a new book though...

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 04:21PM

Hey, it's started doing the SAME thing again, asking for Dreamweaver, even with $_POST for the method :-\

I give up... I must be crazy, lol

Is that code from the book really messed up?

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: stevenmartin99 (193.120.116.---)
Date: November 26, 2008 04:29PM

no it should be POST. But in the proccess order u need $tyre = $_POST]'tyre'] something like this for each form box. Are u sure its not in the book?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 04:42PM

Hey like I said, it's straight from the CD. I typed in a more simple version of it, that's the end code of the chapter...

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 04:49PM

It's me being a donut, lol

I tried to run the file by double clicking on it inside the www folder. I didn't think I needed to start the HTML from localhost. Hopefully this post will help any other newbies who make the same mistake as me :-)

Sorry for wasting your time! smiling smiley))

Thanks again!

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: yfastud (Moderator)
Date: November 26, 2008 05:27PM

he he... he he... ;-)
The world is a little small sometimes, right?
I've used that same book couple yrs ago when I've first started to learn programming in general and wamp in particular, and I still have those scripts in my computer as seen below; mysql and sqlite don't work since I've already removed those db, php does not work properly since syntax is for older php version; however, you should not have problem w/ form
[test.jlbn.net]
[test.jlbn.net]
[test.jlbn.net]

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 08:10PM

Ahhh cool, would you say it's a good book or are there better ones out there? I wanna make a basic community website with a forum...

BTW- I have the forth edition released in October 2008, so I hope the code is up to date :-)

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: November 26, 2008 08:16PM

a good book? ita a useless book. its out of date. the code in it wnt work,

dont buy a book. use forums and php.net. even ask me(email or on my forum link below) if u need help. u learn more by trying then reading

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: yfastud (Moderator)
Date: November 26, 2008 08:55PM

he he... he he... ;-)
No offense, but in my own opinion, no matter how smart you are, you can NOT get anywhere w/o the basic, and no matter how dump you are, you can at least get the idea through definitions, explainations along w/ the source codes and expand from there instead just get the codes alone
Topkat, it's a good book at that time but for current time, most syntax in that book are for old php and mysql versions, so you should google for free php ebook instead; when you'll already learned the basic, you can improve your skill through coding forums ;-)

Have fun,

FREE One A Day
FREE Photo
FREE Games
FREE Websites
FREE Portable GPS
FREE WAMP Guides

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: Topkat (---.bb.sky.com)
Date: November 26, 2008 10:06PM

Thanks for the replies guys. Nice websites you both have too ;-)

Hopefully I'll have a nice one soon aswell:-)

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: ty_the2nd (---.bagu.cable.ntl.com)
Date: December 09, 2008 11:50AM

Topkat Wrote:
-------------------------------------------------------
> It's me being a donut, lol
>
> I tried to run the file by double clicking on it
> inside the www folder. I didn't think I needed to
> start the HTML from localhost. Hopefully this post
> will help any other newbies who make the same
> mistake as me :-)
>
> Sorry for wasting your time! smiling smiley))
>
> Thanks again!


Hi Topkat (and 'all' for that matter)!

I have just bought the same book you are using and have gone through the same headaches as you did. I just pulled the code from the cd (while WAMP - and later XAMPP- was running), double-clicked the orderform HTML file, completed the form and then submit. To my unpleasant surprise I only ended up with a bunch of code in the preprocessor.php being displayed in the browser.
Maybe I did not read carefully the instructions in the book but I can not find details on how to run this whole game. Assumptions of the authors of any prior knowledge on the part of the reader knocks me of my feet, as I only have an intermediate knowledge of Java but I am a complete novice to WAMP and PHP in general.
When you said you have started your HTML file from localhost, what did you mean by that?
Obviously guys, my questions do reveal my novice status so please don't get annoyed and bear with my infirmities.
In case Topkat is not looking at this post anymore, can someone else (who understood his statement) shed some light on the issue of starting a file from localhost. As a silly shot in the dark I copied the files involved in various locations in the WAMP folder, but no joy.
Man, I hate being a novice! Can't wait to change my status on this one!

Many thanks

Ty

Options: ReplyQuote
Re: HTML form asking me to open PHP file in Dreamweaver when submitted
Posted by: stevenmartin99 (---.b-ras1.blp.dublin.eircom.net)
Date: December 09, 2008 11:55AM

open your web browser adn type in h ttp://localhost


this is how you will view your pages..wen wampserver is running

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.