Welcome to Geeklog, Anonymous Friday, November 08 2024 @ 09:44 pm EST

Geeklog Forums

Feedback Form

Page navigation


Status: offline

inquest750

Forum User
Regular Poster
Registered: 03/04/05
Posts: 72
Can anyone help me create a feedback form for my website... I haven't the slightest of clues
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
The simplest way would be to link to your email form (on your site, of course).

bye, Dirk
 Quote

Status: offline

inquest750

Forum User
Regular Poster
Registered: 03/04/05
Posts: 72
I don't know how to create one, can anyone help...
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Did you not like my idea or what appears to be the problem? Confused

bye, Dirk
 Quote

Status: offline

maanmadrasto

Forum User
Newbie
Registered: 06/09/05
Posts: 10
stupid
while browsing through the entire forum in search for the best way to come up with a feedback form, i landed on this one and thought that it was a really brilliant idea.

and after hours and hours of working on my site's forms (there's a lot because it's a real estate site which requires too many documents to fill up!), i finally finished everything and began testing one of them. i tested them so many times until i finally got rid of the error messages. i was so happy!! i almost jumped for joy because apparently, it's already 2:30am here and i thought that i could finally go to sleep. but then i thought of checking my email first to see if i got the form results right... and to my disappointment, among all those fields that i've put there, only the 4 original fields were sent to my email... your name, reply-to, subject, and message. what am i gonna do? how can the form send all the data to my email? i don't know php Sad helpppppppppppppp!!!!! Sad
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
how did you edit your email forms? you'll need to get into the PHP a bit if you want custom fields sent... editing template files wont be enough
 Quote

Status: offline

maanmadrasto

Forum User
Newbie
Registered: 06/09/05
Posts: 10
i basically just copied the entire form from GL's "send email" in the profile's page, and added more fields the regular html way Sad i thought, it was gonna work that way.... what should i do? Sad
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
what else is there besides: to; from; reply to; subject; message? are your fields 'bcc' and the like or stuff that you want added to the body of the email? if the latter, then you'll have to append the content of those fields to $_POST['message'] some how.
However you decide to do this you'll have to edit profiles.php. ...especially if your copied forms are still using profile.php's mail functions (due to copying: form action="{site_url}/profiles.php").
 Quote

Status: offline

maanmadrasto

Forum User
Newbie
Registered: 06/09/05
Posts: 10
i added a lot more fields... it's a real estate website. for example, in the "list your property for lease" form, they have to provide information regarding the property. like what type of property (apartment, condo, etc.), how many bedrooms, how many storeys, how many bathrooms, how much is the renting price... stuff like that Sad
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
try this (untested):

k, each input, textbox, checkbox, etc. returns a name/value pair to the code that will process the form. You want to add all of your added fields to the value being returned with the name/value pair identified by name="message". To do this you need to make that value into an array and add all your extra fields to it. This is how:

1. find name="message" in your form and change it to name="message[msg]". This identifies $message as an array and further identifies this particular name/value pair by the index, msg.

2. for each of your extra fields that you want to be included in the body of your email, make the name of the input (or textarea, whatever) to read name="message[fieldA]", name="message[fieldB]", and so on for all your additional fields.

3. As I said in my previous post, you will have to edit profiles.php if you are using those functions to process the forms. Here is an edited version of the function contactemail() (from gl1.3.9). Just copy this over the one in profiles.php.

remember to back up your stuff.
Text Formatted Code
function contactemail($uid,$author,$authoremail,$subject,$message)
{
    global $_CONF, $_TABLES, $_USER, $LANG08;

    // check for correct $_CONF permission
    if (empty ($_USER['username']) &&
        (($_CONF['loginrequired'] == 1) || ($_CONF['emailuserloginrequired'] == 1))
        && ($uid != 2)) {
        return COM_refresh ($_CONF['site_url'] . '/index.php');
    }

    // check for correct 'to' user preferences
    $result = DB_query ("SELECT emailfromadmin,emailfromuser FROM {$_TABLES['userprefs']} WHERE uid = '$uid'");
    $P = DB_fetchArray ($result);
    if (SEC_inGroup ('Root') || SEC_hasRights ('user.mail')) {
        $isAdmin = true;
    } else {
        $isAdmin = false;
    }
    if ((($P['emailfromadmin'] != 1) && $isAdmin) ||
        (($P['emailfromuser'] != 1) && !$isAdmin)) {
        return COM_refresh ($_CONF['site_url'] . '/index.php');
    }

    // check mail speedlimit
    COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
    if (COM_checkSpeedlimit ('mail') > 0) {
        return COM_refresh ($_CONF['site_url'] . '/index.php');
    }

    if (!empty($author) && !empty($subject) && !empty($message)) {
        if (COM_isemail($authoremail)) {
            $result = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = $uid");
            $A = DB_fetchArray($result);

            // Append the user's signature to the message
            $sig = '';
            if ($_USER['uid'] > 1) {
                $sig = DB_getItem ($_TABLES['users'], 'sig', "uid={$_USER['uid']}");
                if (!empty ($sig)) {
                    $sig = strip_tags (COM_stripslashes ($sig));
                    $sig = "\n\n-- \n" . $sig;
                }
            }

            if (is_array($subject)) {
                $newsubject = '';
                foreach ($subject as $key => $value) {
                    $newsubject .= $key . ': ' . $value . "\n";
                }
                $subject = $newsubject;
            }
            $subject = strip_tags (COM_stripslashes ($subject));
            $subject = substr ($subject, 0, strcspn ($subject, "\r\n"));
            $message = strip_tags (COM_stripslashes ($message)) . $sig;
            if (!empty ($A['fullname'])) {
                $to = COM_formatEmailAddress ($A['fullname'], $A['email']);
            } else {
                $to = COM_formatEmailAddress ($A['username'], $A['email']);
            }
            $from = COM_formatEmailAddress ($author, $authoremail);
            COM_mail ($to, $subject, $message, $from);
            COM_updateSpeedlimit ('mail');

            $retval .= COM_refresh($_CONF['site_url'] . '/index.php?msg=27');
                } else {
            $retval .= COM_siteHeader ('menu', $LANG04[81])
                    . COM_errorLog ($LANG08[3], 2)
                    . contactform ($uid, $subject, $message)
                    . COM_siteFooter ();
                }
        } else {
        $retval .= COM_siteHeader ('menu', $LANG04[81])
                . COM_errorLog ($LANG08[4], 2)
                . contactform ($uid, $subject, $message)
                . COM_siteFooter ();
        }

        return $retval;
}

 


fyi, this is the bit that I inserted to handle the array if one exists:
Text Formatted Code
            if (is_array($subject)) {
                $newsubject = '';
                foreach ($subject as $key => $value) {
                    $newsubject .= $key . ': ' . $value . "\n";
                }
                $subject = $newsubject;
            }
 
 Quote

Status: offline

maanmadrasto

Forum User
Newbie
Registered: 06/09/05
Posts: 10
weeeeehooooooooo!!!!! i got it!! i got it!! i got it!! i got it!! i got it!! i got it!! i got it!! i got it!! i got it!!!!!!!!!!!!!!!!!!! thank you sooooooooooooooo much!!!!!!!!!! Very Happy
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
just guessing here, but does this mean it worked? Shocked
 Quote

Status: offline

maanmadrasto

Forum User
Newbie
Registered: 06/09/05
Posts: 10
excited
well, i took your codes and realized that my error was all about syntax... lol.... i just made another php file to try it out, edited some stuff, and it worked!!! Very Happy Big Celebration thanks to you!!!!!!! now, i'll have to put in all the other fields...... there are lotssssssss of forms there!!! and the entire site will be meaningless if none of the forms would work.... lol....

again, thanks!!! Smile
 Quote

Status: offline

inquest750

Forum User
Regular Poster
Registered: 03/04/05
Posts: 72
Quote by Dirk: The simplest way would be to link to your email form (on your site, of course).

bye, Dirk

Dirk... You wrote for me to "link" to my email form in my site.. i think I just understood this... the Geeklog site has a form plugged into it already and I should link to it independantly? Any and all help is greatly appreciated.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by inquest750: i think I just understood this... the Geeklog site has a form plugged into it already and I should link to it independantly?

Exactly. That's a very simple feedback form, of course, but does not require any coding.

If you want something more sophisticated, see the rest of this thread.

bye, Dirk
 Quote

Status: offline

jetshack

Forum User
Full Member
Registered: 06/29/04
Posts: 122
Location:Texas
machinari,

I've been searchin on the forums for a couple of hours and your suggestion is exactly what i was looking for, but I've run into a problem.

When the form is submitted everything "works" and the email is sent, but the only thing being returned in the email is the word

"Array" Is this not going to work with 1.4sr5?
 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
yeah, er, um.. that is my fault. Embarassed
The code I posted above takes an array for the subject instead of the message. So if you've made message an array in your form, the code above wont handle it and it will just spit out "array" instead of the array's content.

Strange nobody caught that until now. Btw, it isn't necessary to make subject an array because you aren't going to have more than one subject are you?

So here is the same function as above (but from 1.4sr4/5) and slightly edited (I've marked the insert for you.):
Text Formatted Code

function contactemail($uid,$author,$authoremail,$subject,$message)
{
    global $_CONF, $_TABLES, $_USER, $LANG08;

    // check for correct $_CONF permission
    if (empty ($_USER['username']) &&
        (($_CONF['loginrequired'] == 1) || ($_CONF['emailuserloginrequired'] == 1))
        && ($uid != 2)) {
        return COM_refresh ($_CONF['site_url'] . '/index.php');
    }

    // check for correct 'to' user preferences
    $result = DB_query ("SELECT emailfromadmin,emailfromuser FROM {$_TABLES['userprefs']} WHERE uid = '$uid'");
    $P = DB_fetchArray ($result);
    if (SEC_inGroup ('Root') || SEC_hasRights ('user.mail')) {
        $isAdmin = true;
    } else {
        $isAdmin = false;
    }
    if ((($P['emailfromadmin'] != 1) && $isAdmin) ||
        (($P['emailfromuser'] != 1) && !$isAdmin)) {
        return COM_refresh ($_CONF['site_url'] . '/index.php');
    }

    // check mail speedlimit
    COM_clearSpeedlimit ($_CONF['speedlimit'], 'mail');
    if (COM_checkSpeedlimit ('mail') > 0) {
        return COM_refresh ($_CONF['site_url'] . '/index.php');
    }

    if (!empty($author) && !empty($subject) && !empty($message)) {
        if (COM_isemail($authoremail)) {
            $result = DB_query("SELECT username,fullname,email FROM {$_TABLES['users']} WHERE uid = $uid");
            $A = DB_fetchArray($result);

            // Append the user's signature to the message
            $sig = '';
            if ($_USER['uid'] > 1) {
                $sig = DB_getItem ($_TABLES['users'], 'sig', "uid={$_USER['uid']}");
                if (!empty ($sig)) {
                    $sig = strip_tags (COM_stripslashes ($sig));
                    $sig = "\n\n-- \n" . $sig;
                }
            }

            $subject = strip_tags (COM_stripslashes ($subject));
            $subject = substr ($subject, 0, strcspn ($subject, "\r\n"));
//Insert begins ****
            if (is_array($message)) {
                $newmessage = '';
                foreach ($message as $key => $value) {
                    $newmessage .= $key . ': ' . $value . "\n";
                }
                $message = $newmessage;
            }
//Insert ends ****
            $message = strip_tags (COM_stripslashes ($message)) . $sig;
            if (!empty ($A['fullname'])) {
                $to = COM_formatEmailAddress ($A['fullname'], $A['email']);
            } else {
                $to = COM_formatEmailAddress ($A['username'], $A['email']);
            }
            $from = COM_formatEmailAddress ($author, $authoremail);
            COM_mail ($to, $subject, $message, $from);
            COM_updateSpeedlimit ('mail');

            $retval .= COM_refresh($_CONF['site_url'] . '/index.php?msg=27');
                } else {
            $retval .= COM_siteHeader ('menu', $LANG04[81])
                    . COM_errorLog ($LANG08[3], 2)
                    . contactform ($uid, $subject, $message)
                    . COM_siteFooter ();
                }
        } else {
        $retval .= COM_siteHeader ('menu', $LANG04[81])
                . COM_errorLog ($LANG08[4], 2)
                . contactform ($uid, $subject, $message)
                . COM_siteFooter ();
        }

        return $retval;
}


 

let me know if it works, k? ...and thanks for the email Jet. Sometimes I delete my notices quicker than I can read them.

edit: prolly should put the tag and slash control for $message into the loop rather than after it, and then append the signature... but whatever, it should still work. I just don't know what the filters will do to the new line markers.
 Quote

Status: offline

jetshack

Forum User
Full Member
Registered: 06/29/04
Posts: 122
Location:Texas
worked like a charm... thanks for taking a look at it...

If I hadn't been so totally flumuxed I might have noticed the problem... As it was my eyes were crossed.
 Quote

masterjay

Anonymous
confused
Problem solved








 Quote

Status: Banned

machinari

Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by masterjay: If someone can look at the source code at http://unnamedsite.com/contact.html and give a pointer, that'd be great.
that form isn't making any obvious use of the Geeklog software. You'll have to contact whoever wrote your script.
 Quote

Page navigation

All times are EST. The time is now 09:44 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content