BOARDS

planetluc.com discussion board

all about the planetlu.com scripts

You are not logged in.

Announcement

I had to clean the boards due to massive spam. Actually i deleted everything /-one after 1st Oct 2008. It was the only way to get this spam out of the boards. So i'm sorry for all serious users who registered/posted meanwhile.

#1 17-08-2008 17:40:43

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Checkboxes not returning values

Hi...

I've installed this script on my testing server and straight out of the box the checkboxes don't return any values. Everything else seems to be working perfectly. Any ideas?

The only modifications I had to do to the script was add a $global_vars array for DOCUMENT_ROOT so that the script will work with my server. But like I said, everything else works fine.

Let me know what you think could be the problem.

Thanks..

Offline

 

#2 17-08-2008 18:31:10

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

how did you config the checkboxes in the xml file?

Offline

 

#3 18-08-2008 17:33:10

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Re: Checkboxes not returning values

admin wrote:

how did you config the checkboxes in the xml file?

Code:

<item caption="Gender" name="gender" type="checkbox" attr="{Male}{Female}" mandatory="*" error="Please choose your gender" />

Also, I originally uploaded everything with the demo xml intact which used:

Code:

<item caption="Interests" name="interests1" type="checkbox" attr="{Fishing}{Cars &amp; Bikes|cars}{Music|music/sounds}{Cultures}" mandatory="*" error="Please choose at least one interest" />
    <item caption="Interests 2" name="interests2" type="multiselect" attr="{Fishing}{Cars &amp; Bikes|cars}{Music|music/sounds}{Cultures}" mandatory="*" error="Please choose at least one interest 2" />

I also realized that the multiselect isn't returning values either and it uses the same xml that came with the script. I wonder what's wrong?

Thanks for your reply.

Offline

 

#4 18-08-2008 18:28:18

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

hmm - on my tryout installation on this site everything works fine.  What server is your script running on?

Offline

 

#5 18-08-2008 19:50:16

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Re: Checkboxes not returning values

admin wrote:

hmm - on my tryout installation on this site everything works fine.  What server is your script running on?

Yeah I noticed that yours works fine. On MY installation I even uncommented the lines so that it would echo the values of all the fields after submitting the form and the checkbox fields and multiselect fields did not return any values. It is very strange. I'm hosting at mosso.com on a "cloud" server. That's why I had to set a global variable for document_root for the form to find the correct path in the first place.

The server is running PHP 5 Linux / Apache. Like I said, everything else with the script works perfectly.

Any other questions you can ask to help identify what the problem could be?

Thanks!

Offline

 

#6 18-08-2008 20:31:48

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

the output of

Code:

print_r($_REQUEST);

shows absolutely nothing?

Offline

 

#7 18-08-2008 20:48:55

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Re: Checkboxes not returning values

admin wrote:

the output of

Code:

print_r($_REQUEST);

shows absolutely nothing?

The output of that code works as it should. Starting with Array ([nameOfField.. and it shows the value of each field until it gets to the checkbox it outputs this:  [gender] => Array ..and then goes on to show the next fields with their values.

Ideas?

Offline

 

#8 18-08-2008 21:20:06

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

can you quickly post that output?

Offline

 

#9 18-08-2008 21:53:46

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Re: Checkboxes not returning values

Of course this is a fake entry testing the script:

Code:

Array ( [stateHarvest] => Georgia [dateHarvest] => 8-18-08 [timeHarvest] => 1pm [timeRecovery] => 2pm [name] => Somebody [address] => P.O. Box [cityStateZip] => Somewhere, GA, 301xx [phone] => 404-xxx-xxxx [email]=> jason@xxxxxxxx.com [weapon] => Gun [age] => 28 [gender] => Array [request] => Some words go here. [huntDescription] => More words go in here, but it's limited chars. [hash] => drry [Submit] => Send [do] => send [X-Mapping-caklakng] => 1C961DB03B3E3A19742448693D93B12A [PHPSESSID] => 51241fac1007c5bc5e3ab3caf712b9cb )

All field type are "line" except for "Gender" which is the only checkbox. As you can see it returns a value of "Array" which shows up blank in the email.

Thanks for spending time helping me with this.

Offline

 

#10 18-08-2008 22:04:42

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

this is strange, i don't get it why it doesn't loop through the nested array...
i'm afraid that i cannot help in this matter right now... maybe somebody else has any good idea?

Offline

 

#11 18-08-2008 22:45:28

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Re: Checkboxes not returning values

I don't know much about php at all but would have anything to do in these lines of code from formpro.php?

Code:

// kill ' if magic quotes on
                if (get_magic_quotes_gpc() == 1){
                    $_REQUEST[$field[1]] = stripslashes($_REQUEST[$field[1]]);
                }
                
                if ($field[3] == "email"){
                    $message .= "mailto:".$_REQUEST[$field[1]];
                    $mail->From = $_REQUEST[$field[1]];
                }else if ($field[2] == "checkbox" || $field[2] == "multiselect"){
                    $multi = "";
                    foreach ($_REQUEST[$field[1]] as $val){
                        $divider = ($multi != "") ? ", " : "";
                        $multi .= (isset($val) && $val != "") ? $divider.$val : "";
                    }
                    $message .= $multi;            
                }else{
                    $message .= $_REQUEST[$field[1]];
                }
            }
            $message .= "  ";
        }
        $message .= "\n  ";

I didn't change a thing from the original. Does everything look correct?

Offline

 

#12 18-08-2008 22:50:30

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

right! it could be a problem with the stripslashes() func - try to replace lines 200-203 in formpro.php by these lines:

Code:

// kill ' if magic quotes on
if (get_magic_quotes_gpc() == 1 && in_array($field[2], array("checkbox", "multiselect")) === false){
    $_REQUEST[$field[1]] = stripslashes($_REQUEST[$field[1]]);
}

any success?

Offline

 

#13 18-08-2008 23:04:00

admin
Administrator
From: Winterhur, Zurich, Switzerland
Registered: 25-11-2004
Posts: 462
Website

Re: Checkboxes not returning values

or even better, replace it by:

Code:

// kill ' if magic quotes on
if (get_magic_quotes_gpc() == 1){
    if (is_array($_REQUEST[$field[1]])){
        $tmp = array();
        foreach ($_REQUEST[$field[1]] as $key => $val){
            $tmp[$key] = stripslashes($val);
        }
        $_REQUEST[$field[1]] = $tmp;            
    }else{
        $_REQUEST[$field[1]] = stripslashes($_REQUEST[$field[1]]);
    }
}

Offline

 

#14 18-08-2008 23:14:26

itsmejason
Member
Registered: 05-11-2007
Posts: 11

Re: Checkboxes not returning values

admin wrote:

right! it could be a problem with the stripslashes() func - try to replace lines 200-203 in formpro.php by these lines:

Code:

// kill ' if magic quotes on
if (get_magic_quotes_gpc() == 1 && in_array($field[2], array("checkbox", "multiselect")) === false){
    $_REQUEST[$field[1]] = stripslashes($_REQUEST[$field[1]]);
}

any success?

You're BRILLIANT! Replacing that bit of code worked! Thanks so much for spending the time to help me work this out. I really appreciate it.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

 
 
© 2003-2010 by planetluc.com · Bachtelstrasse 104 · CH-8400 Winterthur | Support | Login |