Author |
Message |
killing-hours
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/18f54b284d120ece8c103.gif)
Joined: Oct 01, 2010
Posts: 438
Location: Houston, Tx
|
Posted:
Wed Oct 20, 2010 10:36 am |
|
Hey all-
Working a different, less complex form and I'm hitting a brick wall here and running dry on ideas.
I have this new form... and I want it to submit to a script that is located in the same directory. I'm using the same structure that project tracking uses as I like the way it's laid out.... however, for some reason.. I can't get this durn thing to find the script when I hit submit. (404)
Here is the way I have the directory laid out:
So in my actual form page... this is the form tag
Code:echo '<form id="wpi2form" method="post" action="' . $module_file . '.php?name=' . $module_name . '">'."\n";
==== code here ====
echo '<input type="submit" id="submit" value="Submit" />'."\n";
echo '<input type="hidden" name="op" value="WPI2Submit" />'."\n";
echo '</form>';
|
Since I used the "op" .. in my index.php I have:
Code:case 'WPI2Submit':
include('modules/' . $module_name . '/Form/WPI2Submit.php');
break;
|
And obviously a matching $op in the case.php:
Code:switch ($op) {
case 'WPI2':
case 'WPI2Submit':
case 'ThankYou':
|
Mind you I left other code out to save space. When I hit submit... I get 404'ed every time but I can't see where the page is actually landing because the redirect to the error docs prevents that.
So maybe someone can show me how I'm messing up with the way i'm attempting to do this. Thanks.
P.s.... I can manually enter the address in the address bar and hit my submit page. (modules.php?name=WPI2_Form&op=WPI2Submit) |
_________________ Money is the measurement of time - Me
"You can all go to hell…I’m going to Texas" -Davy Crockett |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/3234de284ee21bd39eecd.jpg)
Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina
|
Posted:
Wed Oct 20, 2010 12:22 pm |
|
how are you defining $module_file |
_________________ Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
killing-hours
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Oct 20, 2010 1:48 pm |
|
I was actually checking into that. I don't see where I'm defining it... but I'm also not sure of the "correct" way to define it.
Where can I read up on using this structure and what the do's and don'ts are?
(structure meaning the case.php, index.php & $op)
--------------------
Edit***
Just added
Code:$module_file='modules';
|
to the top of the index.php and it works... but is this safe or correct??? It can't be that simple. (if so... I'm going to bash my head into the wall)
Side Note** are you in college there in N.C. or originally from N.C.? (I was in Jacksonville for a few years... can ya guess why? ) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Wed Oct 20, 2010 3:00 pm |
|
If if was me I would just hard code "modules.php" instead of using a variable for it. |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
nuken
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Oct 20, 2010 3:01 pm |
|
I guess you were/are a Marine.... I have lived in NC most of my life. There is nothing wrong with defining the module file that way, or just hard code it.
Try changing your code like this:
Code:
==== code here ====
echo '<input type="hidden" name="op" value="WPI2Submit" />'."\n";
echo '<input type="submit" id="submit" value="Submit" />'."\n";
echo '</form>';
|
and see if that helps. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
killing-hours
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Oct 20, 2010 3:35 pm |
|
nuken wrote: |
Code:
==== code here ====
echo '<input type="hidden" name="op" value="WPI2Submit" />'."\n";
echo '<input type="submit" id="submit" value="Submit" />'."\n";
echo '</form>';
|
|
It works fine the way it is now.. I'm sure it would work the same by switching those.
You guessed it. Coming from Houston to N.C. was a shock to me. Soooo much slower there (things in general). I traveled all over N.C. for the fun of it but never really got to see the good stuff if you want to call it that. I spent most of my time down in Willmington (sp?) while I was off duty because I couldn't stand the macho tude most of those idiots filled their heads with there in Jville. It got old fast.
I do miss M-Beach in S.C. though... Loads of good times there.
-----------------------
Is there an advantage/drawback to hard coding it?? Just curious as either way works.
Sorry for questioning so much... but I love to learn. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
killing-hours
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Oct 20, 2010 3:48 pm |
|
(sorry for double post... no edit)
P.S.... Palbin... I can't thank you enough for your work on the Project Tracking module. I've learned so much from scouring your work and seeing how you did things. As I stated on Bobby's site... I plan to donate to both you and him just as soon as I can afford it. (hope to donate 100 here 100 there). Y'all absolutely deserve it plus tons more for your time and effort.
Update on that module... I've got just about every option I wanted into it now and it works great (so far). Hopefully because of this... I will get to shed this crappy side work I do for this small company and go to web admin full time. Y'all are my hero's!!! |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Fri Oct 22, 2010 5:38 pm |
|
killing-hours wrote: | Is there an advantage/drawback to hard coding it?? Just curious as either way works. |
It depends. If it is just your module and you will always love the name of it and never want to change its name, then nothing wrong with hard-coding. However, here are some reasons why you might want to NOT hard-code:
1) If you ever think of changing its name, then your use of $module_name is definitely better.
2) If you wish to distribute your code, I prefer to give folks the option of changing the module name (not talking Custom Label folks), so your use of $module_name is good there too.
3) Last, but not least, for some modules, folks have been known to want to run two separate versions of the module. Not hard-coding the module name throughout, makes that a bit easier, although, of course, there is a ton of work on DB calls if your module has it.
Just some things to think about, but may not even be a concern for you. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Oct 22, 2010 6:37 pm |
|
I agree that you should use a variable for the module name, but I was referring to using a variable to define "modules".php. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Fri Oct 22, 2010 6:38 pm |
|
Oh... yeah, completely unnecessary as modules.php is pretty much a given. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
killing-hours
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Oct 25, 2010 1:08 pm |
|
Right... but Palbin, instead of hard coding it across all the php files in the module.. you (or nukescripts) used a variable instead. No biggie and thanks for explaining it to me guys... just another piece of information stuck in the glue that resides in my head.
I don't plan at this moment of distributing this particular module. I may at some point start to work on a way to build custom forms and database tables from within the module itself so that it can be used without having to hard code things... but I'm not that advanced yet nor do I have the time. Still working on getting mine just right and smoothing out the kinks. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|