O
O
oksana922015-10-29 23:15:37
PHP
oksana92, 2015-10-29 23:15:37

How to pass a variable to another page?

Hello
There are 2 pages

1 page - add value `value input[type="checkbox"]`

jsfiddle.net/Lprptmgk

$('.checkbox-price-bind').on('change', function() {
    		$('.checkbox-price-bind').prop('checked', this.checked);
    	});
    	
    	$("input[type=checkbox]").change(function() {
    		calculate();
    	});	

    	function calculate() {
    		
    		var sum = 0;
    		
    		$("[id^=add-price-]:checked").each(function() {
    			sum += parseInt($(this).val(), 10);
    		});					
    		
    		if(sum < 469){
    			$('input[type="submit"]').attr('disabled','disabled');	
    			alert('У Вас не выбрано ни один из заказов. Пожалуйста отметьте необходимый Вам заказ!');
    		}
    		else{
    			$('input[type="submit"]').removeAttr('disabled');
    		}
    		
    		$("#summ-price > span").html(sum);			
    		
    	}


<form method="post" action="next_page.php" >
    <input type="checkbox" id="add-price-1" class="checkbox-price checkbox-price-list checkbox-price-bind" name="price" value="980" />	
    <label for="add-price-1"><span></span> Price1 - <b>980</b></label>
    <br>
    <br>
    <input type="checkbox" id="add-price-2" class="checkbox-price checkbox-price-list" name="price" value="470" checked />	
    <label for="add-price-2"><span></span> Price2 - <b>470</b></label>
    <br>
    <br>    
    <input type="submit" id="submit" value="Оформить заказ »" />    
        
        
    <p id="summ-price">Сумма: <span>470</span> р</p>  
        
    </form>


The question is: how to pass and display this value to next_page.php

Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-10-29
@R0dger

check what data comes with $_POST
second option in cookies/memcache/redis and pick it up there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question