Jump to content

Recommended Posts

I have an include that processes the log in form for located at the header of every page. The problem is, when it comes to my contact page now I have two forms. So when i process the contact form the header form is checked because the page is sending a post. Is there away that I can use the code below but only have it look at one particular form, so when any other forms are processed it ignores them?

$_SERVER[REQUEST_METHOD]=='POST'

Link to comment
https://forums.phpfreaks.com/topic/179098-_server/
Share on other sites

not sure i follow your solution. How do i use the $_SERVER code with the hidden field?

don't worry about the $_SERVER[REQUEST_METHOD]=='POST' .. as Daniel said, simply use unique submit names for each form:

 

login form in header

...form stuff;
<input type="submit" name="login_header" value="Login" />

 

contact form

...contact form stuff;
<input type="submit" name="contact_form" value="Contact Us" />

Link to comment
https://forums.phpfreaks.com/topic/179098-_server/#findComment-945018
Share on other sites

no, the login form is being processed by the include which does some cURL stuff. The contact form has a quick if statement that says:

 

if (!$_POST['submit'])

{show form}

else

{process mail form}

 

I tried using

if (!$_POST['login'])

on my login include instead of

if($_SERVER[REQUEST_METHOD]=='POST')

but that screwed with my include and caused an error a few lines down

Link to comment
https://forums.phpfreaks.com/topic/179098-_server/#findComment-945389
Share on other sites

sorry, I suck at life...

 

this is my error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/vg001web02/68/11/3001168/web/dev/bsp/includes/login.inc.php on line 6

 

I am not sure why its looking for mysql data because the login form has not been submitted yet. This error happens right off the back regardless of what page I am on. Here are the first 15 lines of login.inc.php

 

<?
//if($_SERVER[REQUEST_METHOD]=='POST')
if (!$_POST['login'])
{
$sql="select * from products where id=$_POST[program]";
$program=mysql_fetch_assoc(mysql_query($sql));
//print_r($_POST);
//print_r($program);
$myAexxis=array(
	"q_system_key"=>$program[sitekey],
	"q_action"=>"CUST_AUTH",
	"q_cust_username"=>$_POST[username],
	"q_cust_password"=>$_POST[password]
	);
	$myCust=new CRM;

 

Link to comment
https://forums.phpfreaks.com/topic/179098-_server/#findComment-945409
Share on other sites

Thanks a million for your help. I see the that the query is running but I have not submitted the form yet so it should not do anything until i hit the login button

the ! before the $_POST['login'] would say otherwise.

 

that ! is like saying NOT:

 

<?php
if (!$_POST['login']) { //is saying, "if $_POST['login'] is NOT set, continue;
?>

 

lose the ! and the code will only execute IF $_POST['login'] has been set, and everything should be fine.

 

<?php
if (isset ($_POST['login'])) {
?>

 

EDIT:  see why posting your code and error(s) with a detailed description of what you are doing to get the error is crucial in getting help sooner than later.

Link to comment
https://forums.phpfreaks.com/topic/179098-_server/#findComment-945432
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.