Subject: Feedback Form

Posted on: 16/06/05 05:22pm
By: inquest750

Can anyone help me create a feedback form for my website... I haven't the slightest of clues

Feedback Form

Posted on: 16/06/05 05:26pm
By: Dirk

The simplest way would be to link to your email form (on your site, of course).

bye, Dirk

Feedback Form

Posted on: 17/06/05 01:29pm
By: inquest750

I don't know how to create one, can anyone help...

Feedback Form

Posted on: 17/06/05 01:53pm
By: Dirk

Did you not like my idea or what appears to be the problem?

bye, Dirk

Feedback Form

Posted on: 23/06/05 02:30pm
By: maanmadrasto

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 helpppppppppppppp!!!!!

Feedback Form

Posted on: 23/06/05 02:36pm
By: machinari

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

Feedback Form

Posted on: 23/06/05 02:43pm
By: maanmadrasto

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 i thought, it was gonna work that way.... what should i do?

Feedback Form

Posted on: 23/06/05 04:03pm
By: machinari

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").

Feedback Form

Posted on: 23/06/05 10:48pm
By: maanmadrasto

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

Feedback Form

Posted on: 24/06/05 01:41am
By: machinari

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.
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:
            if (is_array($subject)) {
                $newsubject = '';
                foreach ($subject as $key => $value) {
                    $newsubject .= $key . ': ' . $value . "\n";
                }
                $subject = $newsubject;
            }

Feedback Form

Posted on: 24/06/05 02:01am
By: maanmadrasto

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!!!!!!!!!!

Feedback Form

Posted on: 24/06/05 02:07am
By: machinari

just guessing here, but does this mean it worked?

Feedback Form

Posted on: 24/06/05 02:19am
By: maanmadrasto

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!!! 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!!!

Feedback Form

Posted on: 27/06/05 04:10pm
By: inquest750

[QUOTE BY= Dirk] The simplest way would be to link to your email form (on your site, of course).

bye, Dirk[/QUOTE]
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.

Feedback Form

Posted on: 27/06/05 04:18pm
By: Dirk

[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?[/QUOTE]
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

Feedback Form

Posted on: 20/07/06 02:35pm
By: jetshack

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?

Feedback Form

Posted on: 20/07/06 05:41pm
By: machinari

yeah, er, um.. that is my fault.
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.):
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.

Feedback Form

Posted on: 21/07/06 10:19am
By: jetshack

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.

Feedback Form

Posted on: 30/07/06 10:28pm
By: Anonymous

Problem solved









Feedback Form

Posted on: 31/07/06 12:23am
By: machinari

[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.[/QUOTE]that form isn't making any obvious use of the Geeklog software. You'll have to contact whoever wrote your script.

Feedback Form

Posted on: 20/08/06 08:14pm
By: Anonymous

Please remove the above quote; My problem has now been solved. Search engines are listing this post when I query for the name of the site, and I'd prefer if that was not so.

Geeklog - Forum
https://www.geeklog.net/forum/viewtopic.php?showtopic=54415