is all I get from this. It is my 2nd attempt at an add(whatever) form. Am I not prosessing this right?
Code:
<?php
//////////////////////////////////////////////////////////////////////
//===========================
// MILPACS
//
// This is the Military Personell and Classification System.
// Donovan [3rd ID]
//
//
///////////////////////////////////////////////////////////////////////
/*********************************************************/
/* Add Soldier to MILPACS */
/*********************************************************/
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
$index = 0;
Now that's an example of a remote 'receiving' script; one that's seperate and named differently from the script sending the form. If the form comes from an index.php within the module itself, then you'd do
Hopefully one of those formats will get your form received... it has to go through modules.php.
Also, looking through your code (and was the case in this little bit of code), you seem to use variables anywhere possible instead where necessary. A variable only needs to be used when the URL (in this case) would change or need to be dynamic. In the case of a form, the receiving script should always be the same, so there's no need for a variable reference to it, just type it right on in as action=modules.php?whatever...!
Along these lines, always try to use static content whenever possible. Even force static content when it will eventually become dynamic. Why? Because you're building things... unexpected variable behavior can take a sane man to his knees in mere seconds. It's always better to write with static content and ensure the program is doing what's expected, then you can add in variables so the program can change depending on need.
If the above 'fix' for you isn't working as expected, let me know the exact name of the script that is sending the form, and the exact name of the script receiving the POST.
Your inline php open/close statement doesn't make sense since you're already within an open php tag (<?php at the top of the script). You only use an inline like this within a pure html doc, like ie.
Code:
<?php
//////////////////////////////////////////////////////////////////////
//===========================
// MILPACS
//
// This is the Military Personell and Classification System.
// Donovan [3rd ID]
//
//
///////////////////////////////////////////////////////////////////////
/*********************************************************/
/* Add Soldier to MILPACS */
/*********************************************************/
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}
$index = 0;
Whenever php hits a php close tag, it begins treating any other code afterwards as html, so there's no need to escape quotes, use echos or add semi-colons. Many authors work in this way, mixing php and html. In the above example then, if bgcolor was defined as a variable (which it is according to Nuke's theme system), you could use an inline php statement for just that one variable, ie.
There's so many styles and options available when coding, but professional php coders stay away from this type of inline use unless it's absolutely necessary. Yes, it's much easier, when you have a huge block of html formatting going out, to just shut off php and let the html flow... less hassle with escapes, etc... but if the html block of code has more than one or two variables in it, it's best to keep it in php and echo it out.
At any rate.. the code you posted does this: an open php tag, php code going out, then you open php -again-, then close it. The rest of your code after the close php is not being processed by php, and therefore the second (and final) closing php tag is meaningless.
I am far from being a "professional". Mostly learning as I go and making my fair share of mistakes along the way. I live by the rule that you wont learn it if you don't do it, and you lose it if you don't use it.
Another question for you...
I have an editsoldier form that display the members name at the top correctly but does not display any of the information for that soldier. What control do you use to display members information?
$info[name] display the name of the member from my members table cause I passed the "id" to the editsoldier page but the text box "uniform" is empty. What variable do I use to display what uniform graphic is in the image/uniform/ directory for that member? Would it be something like <input type=\"text\" $info[uniform]>".
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum