Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Post Installation Help
Author Message
killing-hours
RavenNuke(tm) Development Team



Joined: Oct 01, 2010
Posts: 438
Location: Houston, Tx

PostPosted: Wed Oct 20, 2010 10:36 am Reply with quote

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:

Image

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 
View user's profile Send private message
nuken
RavenNuke(tm) Development Team



Joined: Mar 11, 2007
Posts: 2024
Location: North Carolina

PostPosted: Wed Oct 20, 2010 12:22 pm Reply with quote

how are you defining $module_file

_________________
Tricked Out News 
View user's profile Send private message Send e-mail Visit poster's website
killing-hours







PostPosted: Wed Oct 20, 2010 1:48 pm Reply with quote

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. Wink (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? Razz)
 
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Wed Oct 20, 2010 3:00 pm Reply with quote

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. 
View user's profile Send private message
nuken







PostPosted: Wed Oct 20, 2010 3:01 pm Reply with quote

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.
 
killing-hours







PostPosted: Wed Oct 20, 2010 3:35 pm Reply with quote

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... Sad 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.
 
killing-hours







PostPosted: Wed Oct 20, 2010 3:48 pm Reply with quote

(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!!!
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Fri Oct 22, 2010 5:38 pm Reply with quote

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.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Palbin







PostPosted: Fri Oct 22, 2010 6:37 pm Reply with quote

I agree that you should use a variable for the module name, but I was referring to using a variable to define "modules".php.
 
montego







PostPosted: Fri Oct 22, 2010 6:38 pm Reply with quote

Oh... yeah, completely unnecessary as modules.php is pretty much a given.
 
killing-hours







PostPosted: Mon Oct 25, 2010 1:08 pm Reply with quote

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. Wink

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.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Post Installation Help

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©