chrishea 182 Nearly a Posting Virtuoso

Browsers don't do everything exactly the same and they aren't all as strict in enforcing the rules. Generally speaking, if you follow the rules and code your html and css properly, then all of the browsers, except for Internet Explorer should display something very similar. Internet Explorer is often the exception. Sometimes you can find a solution that works in IE and all of the other browsers but sometimes you need special code for IE. If you do a search, you can find more info on that.

Web pages are displayed on screens of all different sizes. If you display your web page in a window (rather than full screen) and you vary the size of the window, you can see the impact of making the page different sizes. Web pages can be a fixed size and left adjusted or centered. They can also expand and contract based on the size of the screen /window. Whatever you do, it's a compromise. The only thing that doesn't work well is when the page is larger than the width of the screen so the user has to scroll horizontally to see all of the content.

You can protect the directory on the server so the list of modules can't be viewed. Users can execute your PHP modules but they can't view them. You would still be better off putting the ID and password in a config file that is included in your program and the variables inserted into your connect …

chrishea 182 Nearly a Posting Virtuoso

The simplest way is to provide a link or a button with a link to the file. It will open the file in the browser (or download depending on the browser and what they choose to do). You don't want to read the file content and actually display it yourself, you let the browser or their local program take care of it.

A slightly more sophisticated version:
http://www.daniweb.com/web-development/php/threads/238034

chrishea 182 Nearly a Posting Virtuoso

You gain skills and knowledge by doing smaller projects first (and by looking at other people's code). This includes coding standards and debugging skills. You will also pick up modules and code snippets (and build your own library) that can be used to address specific needs when you do further projects.

If you do a relatively small project and the code is organized so poorly that you can barely understand how it works anymore; you can write it off as experience and even rewrite the whole thing if you have to. With a larger project with many modules, if you don't have a good structure and good standards to start with, then you could end up spending a lot of time creating something that you have great difficulty maintaining or changing when it's done. After spending a lot of time to create this much larger system, you would be very reluctant to throw it out and start over (but your ongoing cost if you don't could be quite high). If someone was designing and constructing a multi-storey building, you would expect them to have some training and experience starting with something small. Is software design and construction so much easier that we can just jump in and do it successfully on a large scale before spending the time to develop the appropriate skills and knowledge? I don't think it is. In both cases, I think that the end result may be something in danger of crumbling.

jbennet commented: good advice +0
chrishea 182 Nearly a Posting Virtuoso

A lot of this (not all) is in the eye of the beholder. Any government, no matter how dictatorial or illegitimate, can brand rebels as "terrorists". Because other countries are hesitant to challenge this because of their own loose definition of terrorism, it seems to now be a way to make suppression of dissent legitimate. The original US colonists who rebelled against the UK could have been branded as terrorists under this loose definition. Also remember that a lot of secret funding for the IRA came from US citizens. There is a lot of political convenience and paranoia involved. Never good to put too much trust in what you get from politicians.

chrishea 182 Nearly a Posting Virtuoso

How about

if (isset($row[$z][1])) {
...
chrishea 182 Nearly a Posting Virtuoso

If you mean, can internet access be limited to the server and not be available to the local PCs the answer is probably yes. I'll leave it to others who have more hands-on experience to confirm that and provide any pertinent details.

For the second question, I presume that you are referring to mail server software. Maybe someone will have a specific recommendation. Here is a comparison of mail server packages that are available. What you choose depends partly on what you are running under (Linux vs Windows) and what features are important to you.

chrishea 182 Nearly a Posting Virtuoso

That's great. Please mark this thread as "solved".

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

If your research skills are that poor, you should give up now. I found this in less than a minute:

"After the installation is complete, you will find XAMPP under Start | Programs | XAMPP. You can use the XAMPP Control Panel to start/stop all server and also install/uninstall services."

http://www.apachefriends.org/en/xampp-windows.html

chrishea 182 Nearly a Posting Virtuoso

There is a process to start everything. It doesn't run all the time. I'm not an XAMPP user but I'm sure that there is some pretty obvious documentation about how to start it up.

chrishea 182 Nearly a Posting Virtuoso

How about posting the code within code tags the next time to make it easier to understand.

You have double quotes embedded in your string. How is the poor PHP interpreter supposed to make sense of this since you can't nest strings within strings? You can change the embedded quotes to single quotes as long as there are no variables between the single quotes. The more general purpose solution is to escape all of the nested quotes so they will not be treated as the end of the whole string. Thus (as an example):

$post_xml = "... version=\"1.0\" encoding=\"utf-8\" ... ";

will work. This may not be your only problem but it will fix the problem with the quotes.

chrishea 182 Nearly a Posting Virtuoso

As a server-side programming language, PHP isn't the right way to deal with a device like a modem. You can certainly do it by sending to a third party service or to the phone company server as an email (if they provide that service where you are). If you search this site you will find some previous posts about doing this directly through a modem but you will probably see that it is being done using C or Java.

chrishea 182 Nearly a Posting Virtuoso

If you look at the example you will see that you just need to define the input, the output file name and then include the module.

$dfw_data = $data;
$dfw_filename = "fileout.xls"; 
include ".../desktop_file_write.php";

Your input to this (your $data variable) needs to be a properly formatted html table. Again, see the example. You don't want/need the \t or \n at the end of a line. The line should end with a </tr>.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

Here is a little sample program to demonstrate this:

<?PHP

// This demos how to access (Post) variables that have been created in a series 
// with a base name and an index number.
// For a real app, the $x variable will probably be $_POST

     $count     = 3;            // create this in the form (hidden variable) 
     $x[field1] = "aaaa";       // set up some test data
     $x[field2] = "bbbb";
     $x[field3] = "cccc";
     
     $i = 1;

     while  ($i <= $count) {
          $name = "field".$i;
          $val = $x[$name];
          echo "<br>Do whatever processing needs to be done for ".$val;
          $i++;
     }
?>
aphpdeveloper commented: very helpful +0
chrishea 182 Nearly a Posting Virtuoso

In the module that has the form you are just creating Post variable names by concatenating a couple of values. That's no big deal. You create the variables by using the concatenated string for the name of the Post variable exactly as shown in my previous post. The value would be something that you can use as a key for the DB. Since the program will be working in a dynamic environment where a user can post a new comment at any time, what your program gets (and will display in the form) is a "point-in-time" snapshot. A second later, or while the list is being reviewed by the administrator, someone could add another one. Your program won't show that additional one until you go through the process again. This kind of processing isn't critical, so there isn't a need to be adding to the list in real-time. That would require some fancy code using Ajax and it just isn't necessary. Additions happening while the list is being processed shouldn't create a problem because your Post values should be a key that can be used to reference the database that will still be valid even if additions have happened since the list was produced. If the database was being dynamically re-organized and keys were being changed in real time then that would be an issue but for what you are doing new items should get added to the end (of the DB table) and existing records shouldn't be changing.

chrishea 182 Nearly a Posting Virtuoso

If you want to create a series of variables (checkboxes) in a form and then be able to use those variables in the processing of the form data, you can:

1. Create the variables in a loop using
<input type=checkbox name="check".$i value= ...

giving you a series of variables from check1 to checkn

2. In the program that receives the form data, you can also construct variables with these names but in a slightly different way:

$wk = ${"check".$i};

This creates the $check1 variable (if $i = 1) thus both $check1 and $wk would have
the same value.

aphpdeveloper commented: Thanks for the help so far +0
chrishea 182 Nearly a Posting Virtuoso

Just because it works in one browser doesn't mean that the code will be acceptable to all of them.

Don't know if it will fix your situation but here is one solution to a similar problem.
http://www.figured-it-out.com/figured-out.php?sid=181

chrishea 182 Nearly a Posting Virtuoso

There is more than one version of software with this name. If you are using HTML2PDF V4 from here (the best one), then the examples that come with the distribution demonstrate using images. See exemples/res/exemple00.php

chrishea 182 Nearly a Posting Virtuoso

It's easy to send a text message and there are lots of posts that address that. One example.

If you really want to do this as a voice message, it gets (a lot) more complicated. You now need access to a server that has a telephone network connection and an API that lets you send (or receive) messages. Someone has to pay for that so chances are that it is going to cost you something. A couple of possibilities are:
Twilio
Google Talk
You can do a search and find others.

You might be able to find something off the shelf that does what you want but you're going to have to do some research. If you want to keep it simple, asking for a cell phone number and sending it as a text message is a whole lot quicker and simpler.

chrishea 182 Nearly a Posting Virtuoso

If you get bored with programming that easily, then maybe you just weren't made to be a programmer. Programming requires patience and perseverance. I don't think that there is any way around that. There are solutions like frameworks that are supposed to speed up the development process but in order to get to the point where you can effectively use the framework, you have to invest quite a bit of time to understand it.

One way to cut down the development time is to collect a library of code for common functions. Using include modules and reusing / adapting code can cut down the development time quite significantly. No matter what you do though, I don't think that you'll be able to develop anything significant in a day. There are some code generators (e.g POG) but I don't know if any serious development is being done with them or how much quicker they make the process.

kolibrizas commented: Very interesting tool that you have just suggested. Big thanks! +1
chrishea 182 Nearly a Posting Virtuoso

It does exactly what you programmed it to do!

The first that you could do to see what is happening is to insert a

print_r($_POST);

between lines 6 and 7. If you then run the code, you will see that all of your form variables have been passed back to the module (assuming that this module is called test.php - you don't need the action parameter by the way if you want it to come back to this module).

Then, you need to look at your IF statements on lines 7 and 9 to see if the conditions are satisfied. You will see that is true for line 7 but it might not be for line 9. The main thing is what happens when it gets to line 21. At that point, you have finished processing the form. Logically, the program should stop at this point. Since you didn't put an exit statement before line 21, it keeps right on going and displays the form again starting at line 50. If the 'If' statement at line 9 wasn't satisfied, then it will look as if nothing happened because the form will just be displayed again.

This problem involves how you think through your design and how you debug it if it doesn't work. The php isn't that big a factor. If you don't do the design and the debugging well, then I think you will find developing programs to be quite slow and frustrating. For the debugging …

chrishea 182 Nearly a Posting Virtuoso

Does your php module have a name that ends in .php? Is your localhost running when you try this. If so, what did you install for a LAMP stack? Did you run some sort of simple "hello World" php program at the start to verify that your installation was functioning properly?

chrishea 182 Nearly a Posting Virtuoso

This article looks at some of the strengths and weaknesses of the different options. You need to consider Javascript solutions like JQuery as well. In part, it depends on what you're going to do with it. Mobile apps are becoming a bigger part of the picture but that may not be part of what you want to do. How well PHP integrates with these different approaches is then another question once you establish your preference for a particular approach based on the other criteria.

http://www.codeproject.com/KB/HTML/Enterprise-RIA.aspx

Note: I can say from personal experience that it is quite easy to implement JQuery plugins and requires very little startup time or learning. You don't need to know anything about Javascript to use them. My perception is that you would have to invest some time and energy (and maybe $) if you wanted to start using Flex or Silverlight. It depends how serious you are about it and whether you'll get sufficient payback for that investment. If you are already a Flash or .Net developer, then that would be another factor in the decision.

chrishea 182 Nearly a Posting Virtuoso

As you seem to already recognize, when you include the module with the arrays, you are getting a fresh copy every time. If your intent is to pass these arrays around and update them, then you are right again, using session variables would be the best way to do it. In your include module, you could enclose all the definitions in an if:

session_start();
if ($_SESSION['array_flag'] <> "set") {
   $_SESSION['array_flag'] = "set";
   $_SESSION['model'] = array(1=>"Compact",2=>"Saloon",3=>"SUV" );
   ...
}

That way you'll only do the definitions once. All of your arrays need to become Session variables as I showed above for mode1. Anywhere that you use the arrays, you will now reference the Session versions. Any modules that use the session variables must have a session_start statement.

llamaboy commented: Was simple and easy to understand +1
chrishea 182 Nearly a Posting Virtuoso

A blank page usually means that you had a syntax problem and the program didn't run. If you use an editor that has built in syntax checking (like Netbeans) it will help you find these errors. Indenting your code makes it easier to see some kinds of problems visually.

In this case, you are missing the final bracket for the BlackScholes function.

chrishea 182 Nearly a Posting Virtuoso

The proper format would be:

foreach ( $_POST as $name => $value){something}
chrishea 182 Nearly a Posting Virtuoso

I don't know if you will find this all packaged together. CMS's generally have dynamic menus and individual templates may have multi-level drop-down's built on top of that. If you do a search, you will find many JQuery drop-down menu solutions. If you do a search, you can also find articles about building dynamic menus. This is one example.

chrishea 182 Nearly a Posting Virtuoso

If you main objective is to get something working quickly, then I'd start with a search to see what open source solutions are available.
http://tinyurl.com/42aebds

Even if it is homework, looking at existing systems will still give you a head start.

chrishea 182 Nearly a Posting Virtuoso

I think that you need to work on your debugging skills! $askingPrice is not the same as $asking_price. $askingPrice = 0 so the result is (1-0)* 100 = 100.

chrishea 182 Nearly a Posting Virtuoso

Have a look at this.

chrishea 182 Nearly a Posting Virtuoso

I think that you have three choices.
1. If there is some common factor that links these records together in the database, then you can use that as a selection criteria.

2. If you can collect your criteria before issuing the select, then it can be in the form:

... WHERE contid='firstpic' or contid='secondpic' ...

3. If your criteria is based on input from some source or a table then use a While loop rather than code all the selects individually.

chrishea 182 Nearly a Posting Virtuoso

It sounds as if you are trying to manually configure everything but that is the hard way to do it. There are quite a number of packaged solutions that install the LAMP stack for you and synchronize everything together. You can get more info here.

You don't need IIS in order to develop and test PHP code. It would be simpler to take IIS out of the picture, at least when you are trying to run Apache. If you need to have IIS running at the same time (you should explain why) and that conflicts with Apache then maybe someone else can comment on that.

chrishea 182 Nearly a Posting Virtuoso

OK, so go for it. Maybe you'll want to go to the documentation and look up "file_exists".

chrishea 182 Nearly a Posting Virtuoso

There are just too many students and other newbies who want you to do it for them rather than make some effort, do the research and give it a decent try before asking for help. It adds some traffic to Daniweb but it does nothing for the quality of the site. When people are clearly demonstrating that they are lazy and/or looking for an easy way out, they deserve some negative feedback.

diafol commented: very well said +0
chrishea 182 Nearly a Posting Virtuoso

I don't understand how you have this configured. Normally sub-domains are entirely separate and don't share the same code. You could have parked domains pointing to another domain and then they would all be treated the same and share the same code but that is entirely different. In that case, you can check which domain name was used in the (common) code.

Please clarify.

chrishea 182 Nearly a Posting Virtuoso

There are different versions of HTML2PDF. If you look at this one, you'll find that it does include a <page_header> and <page_footer> command and they can include images.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

You can see ratings for a number of hosting companies here.

I have used ICDSoft for many years. They provide high reliability and great service.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

It appears that there should be another program that has a form and does a POST to this program. This program is processing the POST information that was sent to it.

chrishea 182 Nearly a Posting Virtuoso

It might be simpler to keep using the Perl scripts as they are. Have a look at the link that provides info on using the PHP and Perl together. Never tried it but it might be a viable option.
http://devzone.zend.com/article/1712

Here is a translation guide in case you want to try some conversion:
http://www.cs.wcupa.edu/~rkline/perl2php/

You probably won't find a conversion program but even if you did, it's probable that it wouldn't get everything right and then you would be into some serious debugging and you would need a good understanding of Perl, PHP and what the program is supposed to do to figure it out.

chrishea 182 Nearly a Posting Virtuoso

If your key requirement at this point is to make dynamic changes to a form to build or modify it right on the screen, then you probably need to use Javascript. You could also do a version of this in PHP but it wouldn't be dynamic. You would have to design it so that the user picks the options they want then send it to the server. This is a pretty specialized requirement so I don't think that you want to use this as your criteria for deciding on a language to learn (unless you plan to specialize in building fancy GUI applications).

PHP is a very good all-purpose web programming language with a large user community and lots of free stuff available. Since it is server-based, you have to use Javascript with it if you want the fancy GUI features. Libraries like JQuery make that pretty easy but they may not have the specific capabilities that you need for your current requirement. Learning a language and becoming competent at it is a pretty significant investment of time. You need to consider what kind of programming your are going to be doing and what the key requirements are for it to make the right language choice.

chrishea 182 Nearly a Posting Virtuoso

What is method=\"$_GET\">" supposed to be? Why aren't you using a simple method=get?

chrishea 182 Nearly a Posting Virtuoso

When you get an error on the last line of the program (or even beyond as in this case),
it means that PHP has gone through the module expecting to find a closing brace/bracket (or sometimes a closing quote) and it didn't find it.

In this case, it looks as if the IF statement on line 10 needs a closing brace (maybe on line 13). If you consistently indent your code, it makes it easier to find it.

chrishea 182 Nearly a Posting Virtuoso

What you probably want is a JQuery accordion that lets you click on the header to open the section. See the example below. Even though this example always has one section open, I have implemented accordions where all sections can start out closed.

http://jqueryui.com/demos/accordion/

chrishea 182 Nearly a Posting Virtuoso

Cron is the Linux facility that schedules jobs based on start time. Most hosts provide it. Usually there is some kind of setup utility for it that you can access from your Control Panel. You can schedule a PHP program using Cron but if you prefer Python, you can probably do it that way as well.

chrishea 182 Nearly a Posting Virtuoso

Check the manual for mysql_query. It returns a resource it doesn't return a field.