Jump to content

my accept agreement doesnt show up in mail anymore


Go to solution Solved by Ch0cu3r,

Recommended Posts

Got most of my form done and everything works perfectly...but since i set all values to be returned after error it seems like it wont read the error for my checkbox anymore, and it doesnt show in my mail anymore either (before it would be "Accept: on") does anyone know how this is possible? cuz i believe theres nothing wrong about my code...

 

Error check for the checkbox 'akkoord'

	if (!empty($_POST['akkoord'])) {
		$akkoord = $_POST['akkoord'];
		} else {
		$error .= "- U moet akkoord gaan met de voorwaarden voordat u het bericht kunt versturen. <br />";}
	}

This is to set it should send the info (aka it has been ticked) within the mail

$message .= 'Akkoord:   ' .$akkoord . "\n";

And this is the HTML for the checkbox:

      <input type="checkbox" name="akkoord" id="akkoord" />
      <label for="akkoord">Ik ga akkoord met de voorwaarden</label> 

Just in case something else is wrong and wants to check the full code ill add it as an attachment

test.php

This is not quite right

<input type="checkbox" name="akkoord" id="akkoord" value="<?php if(isset($_POST['akkoord'])) echo 'checked="checked"'; ?> />">

The php code should be outside of the value

<input type="checkbox" name="akkoord" id="akkoord" value="Ja" <?php if(isset($_POST['akkoord'])) echo 'checked="checked"'; ?> />

You say the checkbox value is not being set in the message. This is because with your original code no value is being set for that checkbox.   checked="checked"  is not the value, it is an attribute to mark the checkbox as checked when the form is reloaded again if your form did not pass validation.

 

My code sets a value for the checkbox (  value="Ja"  ) Ja should show up next to  Akkoord:  in the message

Edited by Ch0cu3r

nope still not working, i literally copied your code and replaced mine with it.

and indeed it does keep the checkbox ticked now when form submission fails...

 

but im still having the same trouble with the rest as before,

It still doesnt show the error set for "akkoord" at the top with the rest of the errors, basically now it doesnt matter whether or not i check the box or not, it sends the form anyway.

and the value set for it still doesnt show up in the mail...

im really at a loss for whats wrong

 

I also tried the code without the echo for the checkbox but it gives me the same results

you can send it w/ or w/o checking the box and the value wont show on the mail

  • Solution

Gone through your code and their is a closing brace out of place. The } on line 160 should be on line 136. This is what is causing the value of akkoord and many other fields to not be included in the message.

 

 

 

Just curious what's .= do?

it is the concatenation assignment operator.

 

 

 

Also seen :: ??

it is for accessing a static method/property within a class. It is mainly used in OOP (Object Oriented Programming)

Edited by Ch0cu3r
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.