Im working on a small website and im a little confused on one step. I'm following a very simple mvc pattern, ive currently got one controller that creates a session array that holds all the posted data IF the form has been submitted, This data is coming from several different dropdown boxes which all have different Ids: if(isset($_POST['btn-calcCon'])){ $_SESSION['post-data'] = $_POST; $_SESSION['post-data']['heatingType']; $_SESSION['post-data']['meterType']; $_SESSION['post-data']['noBedrooms']; $_SESSION['post-data']['houseType']; $_SESSION['post-data']['houseAge']; } I have a select statement in my Model class that uses these session variables in a WHERE clause as below: <?php session_start(); require_once('../Config/config.php'); class ConCalc { public $dbconn; public function __construct() { $database …

Member Avatar
Member Avatar
+0 forum 2

SEEMS AS IF MY ARTICLE HAS BEEN SUBMITTED TWICE. I DO APOLOGISE FOR THAT Hi guys, I'm working on a small website and I'm currently stuck on a small issue. Ive got a set of dropdown boxes created and populated in HTML, for example: <select name="heatingType" id="heatingType" required> <option value="" disabled selected>Select Your Option</option> <option value = "Gas">Gas</option> <option value = "Electricity">Electricity</option> <option value = "Other">Other</option> </select> I'm able to store the values in a variable once the form has been posted/submitted, These are stored in my Controller Class eg: $newCalc = new ConCalc(); // instantiate drawing tool $draw = …

Member Avatar
Member Avatar
+0 forum 2

Hello. I right-clicked on a a view (Views/input/index.vbhtml) and chose "set as start page". But it always gave me an error on the browser (The resource cannot be found.) I have to manually enter the url localhost:xxxxx/input/index for it to work. I've already checked routeconfig.vb and it's ok routes.MapRoute( name:="Default", url:="{controller}/{action}/{id}", defaults:=New With {.controller = "input", .action = "index", .id = UrlParameter.Optional} Where can I correct this once and for all? thanks

Member Avatar
Member Avatar
+0 forum 1

This may appear as child problem but i have confusion about this When we document Root what this means?? I am creating directory strucure for framework eg this is directory structure from code tutsplus `----public Document root where public files are accessed -css -images -content -js ------ Resources -library -template -config.php about above structure someone has commented ** this puts credentials inside the doc root meaning it may get publicly available at some point** what does it means?? this is confusing for me help? I have xampp installed and has codeigniter projects in htdocs folder so which is document root …

Member Avatar
Member Avatar
+0 forum 5

What is the best practice for including JQuery in Codeigniter? I've tried including the following line in my controller code: $this->load->library('javascipt/jquery'); But, when the page loads, I get > Unable to load the requested class: Jquery My setup is using xampp, CodeIgniter folder "CI" is located in /htcdocs/ci/. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

How to use two models in a view using Tuple and view model and what is there diffences?

Member Avatar
Member Avatar
+0 forum 3

Action link in my nav menu <li>@Html.ActionLink("Log Off", "Logout", "Account")</li> My Logout.cshtml codes. @{ ViewBag.Title = "Log Out"; Session.Clear(); FormsAuthentication.SignOut(); Response.Redirect("~/../Home/Index.cshtml"); } Why I can't access my logout form?

Member Avatar
Member Avatar
+0 forum 3

Can anyone give me an example to use authentication and authotization in MVC and C#?

Member Avatar
Member Avatar
+0 forum 2

[Autorize] I want to set the page if the user is not currently login in MVC. How can I do it? I want to set it in "User/Login"

Member Avatar
Member Avatar
+0 forum 2

I want to insert from product (id, name, price). How can I insert it using mvc[c#], mssql manually.

Member Avatar
Member Avatar
+0 forum 7

Here's my product table. [id, name, price, description, unit] For example. I want to edit only the name and description. How can I do it in mvc?

Member Avatar
Member Avatar
+0 forum 4

A method in the **controller.php** file public function invoke() { if (isset($_GET['book'])) { // show the requested book $book = $this->model->getBook($_GET['book']); include 'view/viewbook.php'; } else if(isset($_GET['add_book_form'])) { $action = $_GET['add_book_form']; include 'view/add_book.php'; } else if(isset($_GET['add_book'])) { $title = $_POST['title']; $author = $_POST['author']; $description = $_POST['description']; $this->model->addBook($title, $author, $description); include("view/add_book.php"); } else { // no special book is requested, we'll show a list of all available books $books = $this->model->getBookList(); include 'view/booklist.php'; } } Body of my **View/booklist.php** <table> <tr><td>Title</td><td>Author</td><td>Description</td></tr> <?php foreach ($books as $book) { echo '<tr><td><a href="index.php?book='.$book->title.'">'.$book->title.'</a></td><td>'.$book->author.'</td><td>'.$book->description.'</td></tr>'; } ?> </table> <a href="index.php?add_book_form">Add Book</a> Body of the **View/add_book.php** file <div> …

Member Avatar
Member Avatar
+0 forum 2

Hi there, i'm looking for the easiest image slider banner for my homepage, any suggest? Thanks!!

Member Avatar
Member Avatar
+0 forum 8

I am learning MVC and i would love to do my web site with different languages... if the site come from my domain mysite.fr i wanna show french, if comes from mysite.it i wanna show italian.. etc etc So, i did all what the e tutorial asked me to do (Creating a Multilingual Website with ASP.NET MVC 4) but... I tried to follow step by step this tutorial : [Click Here](http://www.ninjacode.com.br/Blog/2013/07/19/creating-multilingual-website-mvc-4/) But when i run my application this eerror come out... Somebody can help? This is the error (i am sorry but is written in french cause i got french …

Member Avatar
Member Avatar
+0 forum 1

i am calling store procedure from MVC, which returns single record only. SP contains: PROCEDURE [dbo].[GetMonthlyReport] @emplID INT = NULL, @month VARCHAR(50) = NULL AS BEGIN IF (@emplID IS NOT NULL AND @month IS NOT NULL) --If Block begins BEGIN SELECT * FROM MonthlyRecord WHERE Month = @month AND EmplID = @emplID END --If block ends ELSE --Else block begins BEGIN RETURN 0 END --Else block ends END now it is selecting, empID, Overtime, Month, TotalDuration from MonthlyRecord View, What i want to do is to put these fields in custom template e.g. HTML TABLE or List, like : <table …

Member Avatar
Member Avatar
+0 forum 4

In if else structure when null arguments are passed to two string variables then it always hit the condition when i have set Var1 != "" && Var2 != "" why ? since nulls are passed to both then why it hits this condition ? code: public ActionResult ShowCalTextBox(String DateFrom, String DateTo) { if (DateFrom != "" && DateTo == "") { IEnumerable<GetEmpRec_DateResult> EmpRec_DateFrom = DataContext.GetEmpRec_Date(DateFrom, null).ToList(); ViewBag.Dates = "Records for"+" "+ DateFrom ; return View(EmpRec_DateFrom); } else if (DateFrom == "" && DateTo != "") { IEnumerable<GetEmpRec_DateResult> EmpRec_DateTo = DataContext.GetEmpRec_Date(null, DateTo).ToList(); ViewBag.Dates = "Records for" + " " + …

Member Avatar
Member Avatar
+0 forum 1

Greetings all. In my MVC app I am trying to iterate through 2 collections, which are similar to a jagged array (a collection of modules, each containing a collection of components). Module and Component each have an Index attribute where the sort order is specified through an admin tool. The flow: 1) Get the user's assigned presentation (pid) 2) Get the modules contained in the pid (mndx), indexed ascending - set index variable 3) Get the components in each mndx, indexed ascending - set index variable 4) Get module index 1 - iterate from component index 1 to last index …

Member Avatar
Member Avatar
+0 forum 10

i am bit confused by the nature and working of query , I tried to access database which contains each name more than once having same EMPid so when i accessed it in my DROP DOWN LIST then same repetition was in there too so i tried to remove repetition by putting DISTINCT in query but that didn't work but later i modified it another way and that worked but WHY THAT WORKED, I DON'T UNDERSTAND ? QUERY THAT DIDN'T WORK `var names = (from n in DataContext.EmployeeAtds select n).Distinct();` QUERY THAT WORKED of which i don't know how ? …

Member Avatar
Member Avatar
+0 forum 2

Hy I want to understand what is a better approach on problem solving point of view for a php project , a framework or the mvc pattern? I would like to add that I know that both principels are quite the same but with a minor diffrence that a framework was made by someone else and has his style applied to it and a mvc pattern you build your own classes and templates and create it in your own style. My concern regarding the mvc pattern is that a application build from scartch is harder to do and create a …

Member Avatar
Member Avatar
+0 forum 5

When I click the login button I never get any values posted to the server. I accept a AuthViewModel but it is always null. I have tried using @html.EditorFor but have not had any luck with it. **User Controller** [HttpGet] public ActionResult Password() { UserModel user = (UserModel)Session[Constants.SessionVars.Authenticate]; //error - need a profile if (user == null) return Redirect("/User/Login"); return View(new AuthViewModel()); } [HttpPost] public ActionResult Password(AuthViewModel password) { UserModel user = (UserModel)Session[Constants.SessionVars.Authenticate]; //error - need a profile if (user == null) return Redirect("/User/Login"); if (password == null || string.IsNullOrEmpty(password.Password)) { ViewBag.Error = Constants.ErrorMessages.UserPassword_PassBlank; return View(new AuthViewModel()); } var dataContext …

Member Avatar
Member Avatar
+0 forum 6

I always getting this error in my dropdownlistfor: Value cannot be null. Parameter name: items View code: @Html.DropDownListFor(model => model.SiteId, new SelectList(ViewBag.ListSiteClass, "SiteId", "SiteName"), "", new { @onchange = "GetSiteid(this.value);" }) Controller Code: [HttpPost] public ActionResult Create(ServiceDTO ms, FormCollection form) { if (ModelState.IsValid) { int sid = ms.SiteId; ServiceDAO.Insert(sid); } else { return View(); } } In loading View: public ActionResult Create() { List<SiteDTO> LSSiteNameList = SiteDAO.GetSiteNameList(User.Identity.Name); ViewBag.ListSiteClass = LSSiteNameList; var service = new ServiceDTO(); return View(service); }

Member Avatar
Member Avatar
+0 forum 14

Hi, In my website i have implemented custom session values. In which, on log on i set the session value to some object. This object is used to extract user specific data from db. now the problem is If user logs in with : test1.somesite.com and logs off and again logs in with: test2.somesite.com that user is still receiving the data from object specific to test1.somesite.com. the point is whichever site user frist logs in with the second time if he logs in with anathor subdomain he is always getting the data from previous sub domain login. on log out …

Member Avatar
Member Avatar
+0 forum 2

i am googling for mvc in php but not get proper result is there any good website from where i can learn mvc for php and, is any other framework needed for this mvc i am currently using bitnamiwamp apche server for php what framework is used for mvc can any one tell me thanx in advance

Member Avatar
Member Avatar
+0 forum 1

I was looking at using the Ext JS 4.1 (http://www.sencha.com/products/extjs/) , it promisses to enable developers to use the model-view-controller (MVC) architecture when building their app. can someone give me an example of how I can use the Ext JS 4 with MVC? if I wanted to create a form using their code, it looks like I need to write a specific form code in JS for each form (with every element I want the form to have) I need, how is that MVC? I'd like an option to build a form using PHP (to retreive data like- name fields …

Member Avatar
Member Avatar
+0 forum 8

I am having some trouble. I have a Telerik editor where I display I file that is housed in my application. I need to save the changes back to the file. But some things also get saved to back to the database. My save button currently does save back to the database, but I don't know how to also make the file save the changes made. Here is my page code: @model BbkValidation.Models.Task @{ ViewBag.Title = "Edit"; } <!--<h2>Edit</h2>--> <h2>@Html.DisplayFor(model => model.Title)</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> @Html.HiddenFor(model => model.TaskID) @Html.HiddenFor(model => model.Title) @Html.HiddenFor(model …

Member Avatar
Member Avatar
+0 forum 17

I am trying to write an MVC application. I am rather new to MVC and I am taking the project over from someone else whom started writing it. This is what I am trying to do. I have some html documents that are located within my application. When a user clicks on a certain link a document opens in an iframe for display. My task controller tells the application which document to open depending on which link was clicked as the data is also stored in a sql database. So all that works fine. What I want the application to …

Member Avatar
+0 forum 0

Hey! for a school project, came to me the following question: the libopenmetaverse is more directed to any of the components of the MVC (model, view, controller) or apply to any of them? someone can help me with this? thanks

Member Avatar
Member Avatar
+0 forum 2

[CODE] RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php/$1 [/CODE] my url = localhost/mvc/ i work on windows in xampp i have a problem when i go to my url /404 i thinks i am on localhost/ so it redirects me to localhost/xampp/splash.php but it will work if i write index.php/404

Member Avatar
Member Avatar
+0 forum 1

Hey guys, what the best practice for session check without duplicate code. I mean when check the session in some controller I have to duplicate the code to other controller, and that is not a good idea. <?php [CODE]class Ctrl extends Controller { private function _ses_check() {...} } class Second_ctrl extends Controller { private function _ses_check() {...} } [/CODE] Where I have to write this "main" things. Write in Model is again bad idea. For that reason I write this topic. Thanks in advance!

Member Avatar
Member Avatar
+0 forum 1

Hi :) i am creating a game in C# the game contain a lot of windows and views i heard about mvvm & mvc design pattern but when i search for them i get only things that relative to asp & wpf... and those are (if i dont get it wrong) web developers should i leave the search for knowledge on those patterns? i dont know nothing about them, i just heard on them and thought if i need to learn about them should i? thank u :)

Member Avatar
Member Avatar
+0 forum 3

The End.