1

I have a hard coded form that i need to send to a php page that i have built. With drupal i am a bit confused on where i would place this php page so it doesnt cause any problems.

I was thinking here but i wanted to check first. /httpdocs/newsite/PHP-HERE (Same directory as index.php)

Where would i place this php page?

3 Answers 3

1

Everything including forms can be integrated nicely within drupal. i would recommend reviewing FAPI. it will save you time/effort in the end.

however, if you absolutely need this not to be built around/within/whatever using drupal's FAPI, what i would do is put the page either directly in your theme folder or make a subfolder and drop it in there. so lets make many assumptions here (awful i know). say your form is called newform.php. rename it to page-newform.tpl.php and drop it into one of those folders. create a page just to give you a node place holder and a path like /newform. then in your template.php file under the THEMENAME_preprocess_page() function, check the URL with either $_GET['q'] or arg() (arg is preferred). if the url is going to /newform simply adjust your $variables['template_file'] to be something like $variables['template_file'] = 'page-newform'. this will pick up your page specifically.

so with a lot of assumptions and very little go on with what you are doing. this could be done.

function themename_preprocess_page(&$variables, $hook) {
 if (arg(0) == 'newform') {
   $variables['template_file'] = 'page-newform'
 }
}
0

I would put it into a pseudo-module and place it in

DRUPALROOT/sites/all/modules/custom/YOURMODULEHERE

in your helper module you can also specify a menu hook, if the resulting URL would be too long or not attractive for your needs.

0

It depends on how much you want your form to be tied to Drupal. If it must insert data in the database, you'd better use FAPI to generate and manage it.

If you're sure your data is totally independant from Drupal, you can manage your form with custom functions in a module, but it will be work and you wont get any benefit from drupal's power.

An alternative would be to use Webform.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.