title: How do I post some variables to a file using opencart?
body: <p>I'm having some trouble posting variables within opencart. What I'm trying to do is to grab two variables from text fields on the checkout/login page, called name and address. I want the values entered into these two fields to be stored when the continue button is clicked, and then sent to the checkout/guest page, where i want to echo out these variables. Here is what i have done:</p>
  
  <p>Here is my checkout.tpl file, where I am attempting to send the name and address variables to the checkout/guest page, specifically to the receive method:</p>
  
  <pre><code>$('#button-account').live('click', function() {
    var name = $('#name').val();
    var address = $('#address').val();
    $.post('index.php?route=checkout/guest/receive', { name: name, address: address});
  </code></pre>
  
  <p>});</p>
  
  <p>Then on the guest.php controller file, I receive the posted variables, and store them in 2 variables called name and address:</p>
  
  <pre><code>public function receive() {
  $name = $this-&gt;request-&gt;post['name'];
  $address = $this-&gt;request-&gt;post['address'];
  }
  </code></pre>
  
  <p>Then on the guest.tpl file, I echo them out:</p>
  
  <pre><code>&lt;?php
  echo $name;
  echo $address;
  ?&gt;
  </code></pre>
  
  <p>When I load the guest page, I get the following error message: Notice: Undefined variable: name in C:\xampp\htdocs\catalog\view\theme\default\template\checkout\guest.tpl on line 13 Notice: Undefined variable: address in C:\xampp\htdocs\catalog\view\theme\default\template\checkout\guest.tpl on line 14. </p>
  
  <p>If anyone can tell me how to make this code work, I would be very grateful. From what I can tell the variables are either not getting sent to the right place, or i am not accessing them correctly on the guest.php page. </p>