variables

How do I add on multiple $_POST['row'] and variables?

I am struggling to find out the syntactically correct way in which to add on more variables and rows to these statements: /* WANT TO ADD ON FIVE MORE $_POST[''] */ if(isset($_POST['check_prof']) && $_POST['check_prof'] == 'checked') { $check_prof = "checked"; }else{ $check_prof = "unchecked"; } /* SAME HERE, WANT TO ADD THE OTHER FI...

Injecting variables into the caller's scope?

Can I define a function which, when called, inserts new locals into the caller's scope? I have a feeling that passing the caller's locals() into the function might work, but is there a way to do what I want without having to do this? ...

Non initialized variable in C#

Right, Another question from me: I have the following piece of code: class Foo { public Foo() { Bar bar; if (null == bar) { } } } class Bar { } Code gurus will already see that this gives an error. Bar might not be initialized before the if statement. So now I'm wondering: what IS th...

Defining a variable in a class and using it in functions

I am trying to learn PHP classes so I can begin coding more OOP projects. To help me learn I am building a class that uses the Rapidshare API. Here's my class: <?php class RS { public $baseUrl = 'http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub='; function apiCall($params) { echo $baseUrl; } } ?> $params will...

what variable i can use instead of shared?

I have the following variable which creates problem when i use multiples instance of the same web form. Could you please let me know how i could what variables other than shared i can use to achieve this purpose? Public strRoleType As String = String.Empty Protected Shared isAreaSelected As Integer = 0 Protected Shared isStoreSelected A...

Calculating with a variable outside of its bounds in C

If I make a calculation with a variable where an intermediate part of the calculation goes higher then the bounds of that variable type, is there any hazard that some platforms may not like? This is an example of what I'm asking: int a, b; a=30000; b=(a*32000)/32767; I have compiled this, and it does give the correct answer of 29297 ...

Java-script object - get variable name

Hi, To begin with, I'm not even sure, if it is the right way to do it. Let's say, i have script (jquery included) like this: foo = function() { this.bar = function() { alert('I\'m bar'); } this.test = function() { $('body').append('<a onclick="my_var.bar();">Click me</a>'); } this.test(); } var my_var = ne...

JavaScript / jQuery: is it possible to change font-size to fill a set width?

Hello there :) I am writing an application, and in it, I would like to have some h1 elements with variable font size. I use the full width (1000px) of a div as a limiter, and a script that automatically sets the font of the h1-element so that it fits the width of the div without line break. This is quite easy to do with php GD, but I ...

Python TKinter connect variable to entry widget

Hi everyone, I'm trying to associate a variable with a Tkinter entry widget, in a way that: Whenever I change the value (the "content") of the entry, mainly by typing something into it, the variable automatically gets assigned the value of what I've typed. Without me having to push a button "Update value " or something like that first...

Variable not evaluating in JavaScript?

Can anyone tell me how do this? They are already integers, so I'm not sure what to try... var lrgSlideShow = { activeClass: 'active', wrapperClass: 'slideshow-widget-large', pauseLength: 2000, fadeLength: 1000 } setInterval(changeImg,lrgSlideShow.pauseLength+lrgSlideShow.fadeLength); ...

.NET MVC - Storing database result during single page result?

Fairly simple issue which is solved in PHP by using a static variable. private static $pages; public function Pages() { if($pages == null) { $pages = new PageCollection(); $pages->findAll(); } } Everywhere in my code I use Pages()::someFindFunction() to make sure the results are fetched only once, and I use tha...

Why is $b "b" in this logic when echoing out ${$b}

I'd have expected ${$b} to be 'a' but it is 'b', why is this the case? $a = "b"; $b = "a"; Sorry again I forgot to put ${$b} produces "b" ...

Using the value of a variable as another variables name in Ruby

Hi, I'm just starting out in learning Ruby and I've written a program that generates some numbers and assigns them to variables @one, @two, @three etc. The user can then specify a variable to change by inputting it's name (e.g one). I then need to do something like '@[valueofinout] = asd'. How would I do this, and is there a better way ...

PHPMailer safe practices - Send escaped / sanitized variables or not ?

I'm using the PHPMailer-Lite class to build an email sending script and I'm not sure if I should use addslashses() on the $name variable when adding it to the constructor. If somebody's last name would be O'Riley (or any other name that contains characters which should normally be sanitized before handling) and I would send it unescaped...

How do you manipulate form values based off local input?

I have a form that has a series of check boxes and some line items have a text input next to them that defines quantity of the item. <input type="checkbox" name="measure[][input]" value="<?=$item->id?>"> <input class="item_mult" type="text" name="measure[][input]" /> What is the best way to capture the integer from the input field a...

Does every PHP code snippet inside the <?php> tag have its own variable scope?

If yes is there any way to access a var defined in another PHP code snippet tag? ...

Java variable function parameters

How do you duplicate this feature in Java? In C#, you could use the params keyword to specify variable parameter lists for functions. How do you do that in Java? Or do you have to resort to multiple overloads? ...

Using the same variable across multiple files in C++

In the process of changing some code, I have spilt some functions into multiple files. I have the files controls.cpp and display.cpp and I would like to be able to have access to the same set of variables in both files. I don't mind where they are initialized or declared, as long as the functions in both files can use them. This was not...

Why does my data not pass into my view correctly?

I have a model, view and controller not interacting correctly, and I do not know where the error lies. First, the controller. According to the Code Igniter documentation, I'm passing variables correctly here. function view() { $html_head = array( 'title' => 'Estimate Management' ); $estimates = $this->Estimatemodel->ge...

How to view Session Variables in Visual Studio 2008 Debugger?

Usually using Visual Studio's debugger is a breeze. Scanning through Locals quickly shows the values of variables, etc. However, I'm at a loss how to find out the values contained in session state variables? Can anyone give me a hand? Lets say I put a breakpoint right after: Session("first_name") = "Rob Roy" How do I view the value con...