Page 2 of 2

Re: Show DIV if input field is >= $row->number

Posted: Fri Jan 08, 2016 10:13 am
by simonmlewis
No it can't.
If we want the discount to be when they add 20 to the field, I want that value to be made 20 via our database.
The Input field cannot be typed in.

So how do I inject it into that code?

Re: Show DIV if input field is >= $row->number

Posted: Fri Jan 08, 2016 10:17 am
by Celauran
JavaScript runs client side. I can manipulate any code that exists on my machine. I can, therefore, change the value of the markup, revealing the hidden box whenever I please. What you need here is additional server-side validation to protect against tampering. As for injecting it, just use a data attribute like I suggested earlier.

Code: Select all

<div class="some-wrapper" data-threshold="10">
    <input foo bar etc>
</div>

Re: Show DIV if input field is >= $row->number

Posted: Fri Jan 08, 2016 10:18 am
by simonmlewis
Can I simply do this?

Code: Select all

<script>
var threshold = '<?php echo $specialnumber;?>';
... <script>
I can pop that value into a variable on a query just above the code.
IT doesn't matter too much, because the Cart is run from a separate system, so even if they hacked it, it would not do it anything - it's more for just a bit of "sales patter" to say "hey... yes you have added a value that means you get a free lollipop"... lol.

Re: Show DIV if input field is >= $row->number

Posted: Fri Jan 08, 2016 10:21 am
by Celauran
You could, though that does nothing to prevent the end user from manipulating that value.

Re: Show DIV if input field is >= $row->number

Posted: Fri Jan 08, 2016 10:22 am
by simonmlewis
Bingo! :)
As I say, it's control "stringently" by our external cart system.
This is more just for the "flannel"... lol.

The pricing and stuff isn't actually passed over!