Jump to content

[SOLVED] $_POST not recongnized anymore???


darksniperx

Recommended Posts

at first I had a php class that contained a function to echo a form and a function to submit it to db

 

<form method="post" action="<?php print $_SELF; ?>" onsubmit="validator()">

 

my class was getting too bulky so I put the form in a separate php file which echoes the content, so I have changed the form header to this.

 

<form method="post" action="forms.php" onsubmit="validator()">

 

here is my forms class

<?php
class forms
{
	var $script;
//temporary variables to use with forms
	var $js_script;
	var $css_script;
	var $body_onload_content;
	var $body_content;

function forms()
    {
	include_once 'fusion.php';
    	$this->fusion = new fusion;

	//when form is being submitted, the following verifyies which form then loads appropriate methods.
    	if($_POST['form_feed_submit'])
	{
		$this->formFeed_submit();
	}
	else if($_POST['formEntry_submit'])
	{
		$this->formEntry_submit();
	}
}
...
}

 

I used bunch of if else statements to find which form is being submitted so I would load an appropriate function, but now when I submit the form, forms.php does nothing, $_POST values are not being passed????

Link to comment
https://forums.phpfreaks.com/topic/74483-solved-_post-not-recongnized-anymore/
Share on other sites

<?php
class forms
{
	var $script;
//temporary variables to use with forms
	var $js_script;
	var $css_script;
	var $body_onload_content;
	var $body_content;

function forms()
    {
print_r($_POST);
print_r($GLOBALS);
}

I get no ouput when I press submit button

 

before I submit I get Array ( ) nothing Array ( ) nothing // the code being in the same file that echoes form content

when I put print global onsubmit, I get this

Array ( ) Array ( [CONSOLE] => /dev/console [sELINUX_INIT] => YES [TERM] => linux [iNIT_VERSION] => sysvinit-2.85 [PATH] => /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin [runlevel] => 3 [RUNLEVEL] => 3 [PWD] => / [noexec32] => off [LANG] => en_US.UTF-8 [previous] => N [PREVLEVEL] => N [pax_softmode] => 1 [sHLVL] => 3 [HOME] => / [RESTARTSRV] => 1 [_] => /usr/local/apache/bin/httpd [DOCUMENT_ROOT] => /home/frdowd3/public_html [HTTP_ACCEPT] => */* [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_ACCEPT_LANGUAGE] => en-ca [HTTP_CONNECTION] => Keep-Alive [HTTP_HOST] => adventus-test.org [HTTP_UA_CPU] => x86 [HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.30) [REMOTE_ADDR] => 216.252.78.240 [REMOTE_PORT] => 3056 [sCRIPT_FILENAME] => /home/frdowd3/public_html/alex/test/index.php [sERVER_ADDR] => 67.43.10.51 [sERVER_ADMIN] => [email protected] [sERVER_NAME] => www.adventus-test.org [sERVER_PORT] => 80 [sERVER_SIGNATURE] => 

you have created a link to a class that accepts submitted forms

ex: $form = new form;

that class has a function that processes the form

ex: formSubmit();

I have used a default constructor and if else method to find which form was beins submitted.

I have taken out if else statement from default constructor and changed <form> tag to this

ex: <form action="<?php $form->formSubmit(); ?>" method="post">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.