• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PHP code file doesn't work in Dreamweaver, but does on web server

New Here ,
Sep 03, 2009 Sep 03, 2009

Copy link to clipboard

Copied

Although I've been a programmer/systems analyst for 50 years, I'm new to web programming; I guess this makes me a dinosaur.  Anyway, I've been learning PHP/MySQL and Dreamweaver, and have encountered a strange issue.  I created a small (test) web page with a two field form (i.e. Name and Messagel) and a "Go" button which calls a small php file (i.e. action="helloworld.php" method="post").  The php file simply collects the two fields and "echo"s them to the screen.  When I try to execute the form in Dreamweaver, using the "Live View" button, nothing happens.  When I use the "Preview/debug in Browser" button the page opens in the (IE7) browser, but when the Go button is pressed, the Dreamweaver item in my taskbar starts blinking.  When I then switch back to Dreamweaver, the php file has been placed in the workspace, and the cursor is located at the very start of the code (ie @ the "<?php).

Now here's the strange part (at least to me), If I publish the two files to my web server (index.html & helloworld.php)  IT WORKS.  I can enter data into the two fields, press the Go button, and the php code echoes the information on the screen.  Can anyone tell me what I must be doing wrong to cause this?

TOPICS
Server side applications

Views

4.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 03, 2009 Sep 03, 2009

Copy link to clipboard

Copied

Setup a local testing server to view dynamic pages locally.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 03, 2009 Sep 03, 2009

Copy link to clipboard

Copied

I've tried to do that, but the dialogs are very confusing and couldn't get it set up.

I do have a ZAMPP installation using Apache on my local computer, and the pages work there, but for each time I want to test, it's a real pain to:

     1)  Close Dreamweaver (if I leave it open I get griev)

     2)  Copy the files to XAMPP's htdoc folder

     3)  Open a browser window

     4)  Type in "HTTP://localhost/index.html

     5)  Check out the program

     6)  Go back to Dreamweaver for more work.

I could certainly use some help there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Sep 03, 2009 Sep 03, 2009

Copy link to clipboard

Copied

Heya,

Look into setting up your virtual host so that you do not need to copy files from Dreamweaver site location to XAMPP's htdoc folder as you've mentioned in step 2.

With virtual hosts setup you can leave the site files in the original location that you've setup in Dreamweaver and enter site1, site2, etc. in browser to preview without copying the files to XAMPP's htdoc folder. Your Live View should also function correctly in Dreamweaver after you have properly setup virtual hosts to point to location of files in Dreamweaver.

Your current problem is that local testing server is looking for site files in XAMPP's htdoc folder whereas Dreamweaver is looking for them in a different location (which is not setup for local testing server via virtual host). As a result you can not view dynamic pages in Dreamweaver site location. Setup virtual host to point to Dreamweaver site location in order to view dynamic pages via Live View. Remember to restart Apache after making changes to virtual hosts in order for the changes to take effect.

Hope that helps.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 04, 2009 Sep 04, 2009

Copy link to clipboard

Copied

Actually it's partly answered.  I followed your link, read the instructions and set up my virtual host testing site (I think).  The instructions were quite confusing (i.e. terms/jargon not clearly defined for newphites), so I'm not sure the set up completely correct; I'm using XAMPP, but the instructions gave examples only with other products, so there's still some doubt about the accuracy of my settings.

In any event, the forms now work in XAMPP when I click the "globe" icon, but they still do not work in "Live View"  While this isn't the worst thing in the world, I'd sure like to be able to use live view since it's so much faster for quick tests.  Can you tell me just which settings address the Live View capability?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

Copy link to clipboard

Copied

creacontech wrote:

Can you tell me just which settings address the Live View capability?

Live View doesn't need any special settings. However, you do need to define the testing server correctly in Dreamweaver. You'll find details in the following article: http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php.html.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 04, 2009 Sep 04, 2009

Copy link to clipboard

Copied

Thank you for your kind post and link.  I followed the instructions to the letter (these were quite clear and understantable), but my php file doesn't execute from the "Live View" button.  I double & triple checked all the settings to see that they accurately reflect the instructions, and they do.  When I use the Globe button, everything works fine (it's in XAMPP at that point), but not in Live View.  The php file is a very simple script that simply loads a set of variables with the $_POST data, then "echo"s it to the screen.  When I try to use it in Live View, all that happens when I press the Submit button, is a bright flash, then nothing; no display whatsoever.

If anyone has any ideas as to what's causing this behavior, please let me know, and thank you all again for your kind respnses.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 04, 2009 Sep 04, 2009

Copy link to clipboard

Copied

If the page needs $_POST data, you need to set that up by clicking the down arrow to the side of the Live View button. Select HTTP Request Settings, and set the variables there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 05, 2009 Sep 05, 2009

Copy link to clipboard

Copied

Thanks again David, however, having done that, it still doesn't work.  Wasn't sure which page you were referring to (ie the "sending" page or the php page), so I tried each one individually, then both together.  Still no results.

I really appreciate you sticking with me on this, as I'm just learning Dreamweaver (love it so far).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2009 Sep 05, 2009

Copy link to clipboard

Copied

Live View displays pages as they will look in a browser, and it's interactive in that it shows JavaScript and CSS dynamic effects. However, it doesn't support form submission or follow links. Perhaps you're trying to get Live View to do something that it's not capable of.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 05, 2009 Sep 05, 2009

Copy link to clipboard

Copied

LATEST

I guess that's the answer.  The submit button uses the "action=" to call my php code at procdata.php, and since you said that only java script and css effects are supported, I guess my php call won't work.  It works fine, however, when I press the globe icon; it goes straight to my xampp server that you so graciously helped me set up.  Now that I'm getting the hang of a lot of the dreamweaver panels, look and feel, I feel like I'm in high cotton.  Thanks again for all your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines