Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
p-01 contact errors
#1
I copied the Tag Examples from http://nliautaud.fr/wiki/travaux/p01-contact. Specifically, copied the one titled "A big one:".

After removing all the extra space between the fields, the form appeared as expected. I can fill out and send the form as expected and get the message that the email was sent. I also actually receive the email. However, I'm left with several error messages at the top of the screen. Specifically...

Warning: Invalid argument supplied for foreach() in /usr/home/dblewett/public_html/tealacn/plugins/p01-contact/p01-contact.php on line 965

And the message repeats for lines 975 and 952. I haven't changed anything in that php file, or any other file. I also get this message if I'm in debug mode.

What is causing this?
Reply
#2
well, I think this is because the plugin is not updated for some time

my personal suggestion:
if you receive all the posts and everything else is ok, just ignore these messages
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#3
(2013-04-11, 19:05:30)Connie Wrote: well, I think this is because the plugin is not updated for some time

my personal suggestion:
if you receive all the posts and everything else is ok, just ignore these messages

No, I don't think so. Imagine you're a customer on my site, I've just asked you to invest money or buy my products or hire me to build you a web site or any number of other scenarios. You fill out a contact form and are presented with this response...

Warning: Invalid argument supplied for foreach() in /usr/home/dblewett/public_html/tealacn/plugins/p01-contact/p01-contact.php on line 975

Warning: Invalid argument supplied for foreach() in /usr/home/dblewett/public_html/tealacn/plugins/p01-contact/p01-contact.php on line 965

Warning: Invalid argument supplied for foreach() in /usr/home/dblewett/public_html/tealacn/plugins/p01-contact/p01-contact.php on line 952

Yeah, that won't work.
Reply
#4
It works okay for me, did you try it even without your changes?
Try to do the changes again and control the form functionality after every important step.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#5
(2013-04-12, 00:46:25)TeeJay Wrote: It works okay for me, did you try it even without your changes?
Try to do the changes again and control the form functionality after every important step.

The changes that I made are as follows.

The original text in the support document at http://nliautaud.fr/wiki/travaux/p01-contact shows

(% contact : address@domain.ext, another@domain.ext,
subject => About this script,
email!,
textarea "How old is born Napoléon?",
phone,
radio "Do you like this script?" = "Yes" selected | "No",
website,
select = "One" selected | "Two" | "Three" | "Four" | "Five" ,
message = Say something!,
password = tomato,
captcha,
askcopy %)

When I place that text exactly in my page and then view the page, it shows me that text printed on the page, no form. (I did change the email address)

I edited the text so that it looks like this.
(% contact : address@domain.ext, another@domain.ext, subject => About this script, email!, textarea "How old is born Napoléon?", phone, radio "Do you like this script?" = "Yes" selected | "No", website, select = "One" selected | "Two" | "Three" | "Four" | "Five" , message = Say something!, password = tomato, captcha, askcopy %)

All I did was delete all the extra spaces and line feeds. But I do like the potential of this form and will continue experimenting.

I should add this. If I simply put (% contact %) on my web page and put the select elements in the plugin's default parameters section of the settings page, I get the same results.

I should also add that if I create a form with no checkbox, select, or radio fields, then the form works perfect with no errors.
Reply
#6
@dblewett

Look,

Line 952 is a checkbox
Code:
case 'checkbox' :
                foreach($this->value as $i => $v) {
                    $value = !empty($v[1]) ? ' ' . $v[1] : '';
                    $selected = !empty($v[2]) && $v[2] == 'selected' ? ' checked' : '';
                    $html .= '
                    <input id="' . $id . '_option' . $i . '"';
                    $html .= ' type="checkbox" name="' . $name . '[' . $i . ']"';
                    $html .= ' value="' . $value . '"' . $disabled . $selected;
                    $html .= ' />' . $value;
                }
                break;
965 is a select
Code:
case 'select' :
                $html .= '
                <select id="' . $id . '" name="' . $name . '"' . $disabled . '>';
                foreach($this->value as $i => $v) {
                    $value = !empty($v[1]) ? ' ' . $v[1] : ' Default';
                    $selected = !empty($v[2]) && $v[2] == 'selected' ? 'selected="selected"' : '';
                    $html .= '
                    <option id="' . $id . '_option' . $i . '" value="' . $value;
                    $html .= '"' . $selected . ' >' . $value . '</option>';
                }
                $html.= '</select>';
                break;
and 975 is a radio
Code:
case 'radio' :
                foreach($this->value as $i => $v) {
                    $value = !empty($v[1]) ? ' ' . $v[1] : ' Default';
                    $selected = !empty($v[2]) && $v[2] == 'selected' ? ' checked' : '';
                    $html .= '
                    <input id="' . $id . '_option' . $i . '" type="radio" ';
                    $html .= 'name="' . $name . '" value="' . $value . '"';
                    $html .= $disabled . $selected . ' />' . $value;
                }
                break;

Now you know what is causing the problem. Try the form without these extra fields, it should be ok.
But I don't know how to correct it with them, I don't know what's wrong, I'm not good at PHP at all.

Just to make sure, is it true that the errors are shown even if you don't delete the spaces?
Are you using the latest GS and the latest p01-contact? Smile


(2013-04-12, 00:59:31)dblewett Wrote: I should also add that if I create a form with no checkbox, select, or radio fields, then the form works perfect with no errors.
Sorry, as I explained above, I don't know why it doesn't work with these fields.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#7
add "askcopy" causes errors
Reply
#8
Well, I tried it and yeah it's wrong but I don't see what to do about it. We would need someone who understands the code well.

I attached an image with the form, the e-mail received and the error. The problem is only with the select, checkbox and radio - the askcopy works well, got both e-mails and no error.

So the only problem is the warning after sending the message which can be really disturbing and making the sender unsure if everything went well.

See the picture:
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#9
works for me with no errors
Reply
#10
(2013-04-18, 00:42:19)Oleg06 Wrote: http://business-website.ru/shablony-dlya...3/?lang=ru
works for me with no errors
Yeah, it really works. What version of the GetSimple are you using? What version of the p01-contact? And can you post the code of your ( % contact % ) ? Thank you.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
#11
GS version 3.1.2? p01-contact version 0.9.1
Code:
(% contact :text! "Ваше имя", email!, subject! Заказ сайта, text! "№ шаблона" {%page-slug%}, radio "Выберите цвет" = "Синий" selected | "Серый" | "Зеленый" | "Красный" | "Другой",  text "Укажите цвет - #000000",select "Примерное количество страниц" = "5" selected | "6 - 10" | "более 10" | "более 20" | "более 30" , checkbox "Дополнительные плагины"="Опросы" | "Отзывы" | "Частые вопросы" | "Социальные сети", message! "Ваши пожелания", captcha %)
After I added the "askcopy" errors appear
Reply
#12
(2013-04-18, 01:16:59)Oleg06 Wrote: GS version 3.1.2? p01-contact version 0.9.1
Code:
(% contact :text! "Ваше имя", email!, subject! Заказ сайта, text! "№ шаблона" {%page-slug%}, radio "Выберите цвет" = "Синий" selected | "Серый" | "Зеленый" | "Красный" | "Другой",  text "Укажите цвет - #000000",select "Примерное количество страниц" = "5" selected | "6 - 10" | "более 10" | "более 20" | "более 30" , checkbox "Дополнительные плагины"="Опросы" | "Отзывы" | "Частые вопросы" | "Социальные сети", message! "Ваши пожелания", captcha %)
After I added the "askcopy" errors appear

That is a great finding. It really works if not using the "askcopy", so we can make it work properly without any problems. I don't think that askcopy is something important. Most internet forms are without it Smile

Thank you Oleg06.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply




Users browsing this thread: 3 Guest(s)