pwired Posted September 26, 2014 Share Posted September 26, 2014 Does anyone know where to find a quick form ? A simple one where a visitor can enter name, email, and request. I know it can be done extending on something like this <form method="post" action="sendmail.php"> Email: <input name="email" type="text" /><br /> Message:<br /> <textarea name="message" rows="15" cols="40"> </textarea><br /> <input type="submit" /> </form> but need something out of the box coded quick. maybe google Link to comment Share on other sites More sharing options...
diogo Posted September 26, 2014 Share Posted September 26, 2014 Google forms are great https://docs.google.com/forms/d/1Mb1wReBKt7QR1CDmxNlaHTBJ03x6UVvXoLKQ0pxsMWw/viewform Link to comment Share on other sites More sharing options...
pwired Posted September 26, 2014 Author Share Posted September 26, 2014 I told you guys this forum is full of gold, look what I found here: https://processwire.com/talk/topic/407-processing-contact-forms/ And guess what: I have it working! 1 Link to comment Share on other sites More sharing options...
kongondo Posted September 26, 2014 Share Posted September 26, 2014 You might want to add it to your list of snippets post (I can't find it now...) 2 Link to comment Share on other sites More sharing options...
pwired Posted September 26, 2014 Author Share Posted September 26, 2014 It´s here https://processwire.com/talk/topic/407-processing-contact-forms/#entry36384 And yes added this gold to my snippet library I am expanding successfully on this form code with Land, Order, etc. I works beautifully when input type is text or email. Only have a problem when input type is radio or checkbox Then: $msg = "Full name: $form[fullname]\n" . "Email: $form[email]\n" . "Land: $form[land]\n" . "Bestellung: $form[bestellung]\n" . "Comments: $form[comments]"; the contents of "Bestellung: $form[bestellung]\n" is not sent. I think I use something wrong here <p> <label for="bestellung">Bestellen</label><br /> <input type="checkbox" id="bestellung" name="bestellung" value="$form[bestellung]" />1 Set<br> <input type="checkbox" id="bestellung" name="bestellung" value="$form[bestellung]" />2 Sets<br> <input type="checkbox" id="bestellung" name="bestellung" value="$form[bestellung]" />3 Sets<br> <input type="checkbox" id="bestellung" name="bestellung" value="$form[bestellung]" />4 Sets<br> </p> value="$form[bestellung]" works if in input type="text" but stops to work when type="radio" or type"=checkbox" Maybe I have to enter a text string in value like so: value="Set 1" and then assign in some way "Set 1" to $form[bestellung] so that it can be sent correctly in the part "Bestellung: $form[bestellung]\n" . $msg = "Full name: $form[fullname]\n" . "Email: $form[email]\n" . "Land: $form[land]\n" . "Bestellung: $form[bestellung]\n" . "Comments: $form[comments]"; Link to comment Share on other sites More sharing options...
pwired Posted September 26, 2014 Author Share Posted September 26, 2014 Ok, after digging with google I found my error. It was in my thinking. Still happens as long as code looks like crypto during the learning process. First of, in the part name="some_name" name is the variable that is assigned the string in value="some_value". So, in type="radio" or type="checkbox" the same thing happens as in type="text" or type="email" where it already was working. In the part value="$form[bestellung]" I replaced $form[bestellung] with a text string corresponding to the selection radio or checkbox, e.g.: <input type="checkbox" id="bestellung" name="bestellung" value="two_sets_wheels" />2 Sets of wheels<br> Now it's working and the contents of "Bestellung: $form[bestellung]\n" is sent with $msg in the email. msg = "Full name: $form[fullname]\n" . "Email: $form[email]\n" . "Land: $form[land]\n" . "Bestellung: $form[bestellung]\n" . "Comments: $form[comments]"; So in case of where input type="email" or type="text" you can use the variable in name="email" or name="fullname" as value="$form" or value="$form[fullname]" but in case of where input type="radio" or "checkbox" value has to be a text string like value="2_sets_wheels" The fact that my form is now sending the values in input type="radio" is proof that I am on the right track. If anyone can add or improve something to this, please be welcome. Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted September 27, 2014 Share Posted September 27, 2014 (edited) You might want to add it to your list of snippets post (I can't find it now...) @pwired: Please share a link to your forum guide. I've found it once, when I was for doing something similar, but never again)) What's the use of forum guide if it can't be found itself )) Seems like everybody's going for some .pw sites now. Why don't you start something like pwforumguide.pw? It might be easier to contribute to than those snippets ones, as you only have to share a link in a carefully constructed tag or category structure. I personally would use it, because I seem to never find the right forum post when I need it. I just know that "the truth is out there". Edited September 27, 2014 by Ivan Gretsky 1 Link to comment Share on other sites More sharing options...
mr-fan Posted September 27, 2014 Share Posted September 27, 2014 google search for "beginner guide" or "code snipptets tutorials" finding this two: https://processwire.com/talk/topic/6731-beginners-guide-to-processwire/ https://processwire.com/talk/topic/4173-grouped-forum-posts-links-articles-tutorials-code-snippets/ regards mr-fan Link to comment Share on other sites More sharing options...
pwired Posted September 27, 2014 Author Share Posted September 27, 2014 What's the use of forum guide if it can't be found itself )) Exactly, you said it. My snippet thread was a nice attempt but is hardly found like so many other great posts in the forum. Blame it on ppl who have a reason not to spend time searching directly in the forum categories. Why don't you start something like pwforumguide.pw? I figured out time ago that the pw forum needs a proper index and already registered a domain for it. Not only for giving a better focus on all those good threads and slow down questions with repeat=on. (I also make my self guilty on this every now and then), but also to expand on processwire. PW is not only a unique opportunity for ppl to make websites and to make your steps into the world of coding, but => also to expand on it. just look at the websites made by teppo and nico. Edit: time is not on my side so it´s not going to be there soon. 1 Link to comment Share on other sites More sharing options...
Recommended Posts