0

Project Structure

So I've just begun to learn about the MVC pattern and am adapting some of my current code to an MVC structure. Above is an image of my folder structure for reference.

The outer index.php is inlcuding the view/index.php, which in turn includes both login.php and controller/indexController.php.

The issue I'm having is with the form actions when I submit on my index page.

<form action="" method="post">

So my action=" ", as I want to post to the same page since my view/index.php includes the indexController.php

However when I click login

I'm being sent to localhost/Workspace/index.php instead of localhost/Workspace/lab3/index.php, which is the wrong page completely.

Btw, I am using Wamp. I hope I've explained the issue clearly enough, but if you need any clarifications I'll gladly oblige.

Thank you for the help.

Community
  • 1
  • 1
user3176159
  • 1
  • 1
  • 3
  • Need more info. Do you have html that sets base url? What is the url of your form page? What is your document root? As an aside, you're a little sideways on "view/index.php includes the indexController.php" It should be the other way around. You should have a document root, ie `lab3/www/index.php` which then hands off control to the proper controller, ie `controller/indexController.php` which then displays `views/index.php` – Tim Morton May 30 '17 at 02:42
  • There is a difference between `action=" "` and `action=""`. Which are you really using? Your question contains both. – elixenide May 30 '17 at 02:42
  • Virtual Hosts https://stackoverflow.com/questions/23665064/project-links-do-not-work-on-wamp-server/23990618#23990618 – RiggsFolly May 30 '17 at 21:29

0 Answers0