Welcome Guest, Not a member yet? Register   Sign In
Paypal_lib Success Page Problem
#1

[eluser]Jesse Schutt[/eluser]
This code is in the "Success" view of the Paypal_lib. It is not displaying any information regarding the _POST information. Actually, it isn't displaying anything at all other than the "Success, Your Payment was received..." Any ideas?

Code:
<h2>Success!</h2>

<p>Your payment was received using Paypal.</p>

&lt;?php if($this->input->post()): ?&gt;
<p>Here's its information:</p>
<p><code>
&lt;?php    
    foreach ($this->input->post() as $key => $value)
        echo '<strong>$key</strong>: $value <br/>';
?&gt;
</code></p>

&lt;?php endif; ?&gt;

If I insert the following, I can see results, so I am pretty sure that there is _POST data.

Code:
&lt;?php
if (isset($_POST))
{
   print "<pre>". htmlspecialchars(print_r($_POST, TRUE)) ."</pre>";
}
else
{
   print '$_POST not set!';
}
?&gt;

Jesse
#2

[eluser]Jesse Schutt[/eluser]
I'm curious as to why print_r works and not $this->input->post()...
#3

[eluser]missionsix[/eluser]
since this:

$this->input->post()

is a method, its going to check if the key passed has an associated value. Since you are not passing a key, there is not key / value pair to check it against in $_POST, so its going to return false, which is why you can't see anything.
#4

[eluser]Jesse Schutt[/eluser]
Thanks for the response MissionSix!

As I'm sure you can tell, I am just learning how to get around in all of this.

What would you suggest I do to access the values held in the $_POST array?

Thanks Much!

Jesse
#5

[eluser]Bramme[/eluser]
If you want to loop through them, I'd simply use the $_POST array, seeing as

$_POST[$key] == $this->input->post($key) == $this->validation->$key
#6

[eluser]missionsix[/eluser]
loop through the $_POST[$key]'s, but reference the $_post data through $this->input->post($key). This way your input will be cleaned before use (xss filtering, etc)
#7

[eluser]Jesse Schutt[/eluser]
Thanks for the help. If it's not too much trouble, could you give me a sample of what you mean? I am doing my best to learn all of this.
#8

[eluser]missionsix[/eluser]
Yeah, sure:

From your example:

Code:
<h2>Success!</h2>

<p>Your payment was received using Paypal.</p>

&lt;? if($_POST): ?&gt;
<p>Here is its information:</p>
<p><code>
&lt;?php    
    foreach ($_POST as $key => $value)
        echo '<strong>'. $key .'</strong>:'. $this->input->post($key) .' <br/>';
?&gt;
</code></p>
&lt;?php endif; ?&gt;


you were also having problems with your echo statement. You used single quotes with enclosed Vars and that won't work in php.
#9

[eluser]Jesse Schutt[/eluser]
Thank you very much! I'll go through this and see if I can't figure it out for myself.

I really appreciate your help.

Jesse
#10

[eluser]Bramme[/eluser]
[quote author="missionsix" date="1220155851"]loop through the $_POST[$key]'s, but reference the $_post data through $this->input->post($key). This way your input will be cleaned before use (xss filtering, etc)[/quote]$_POST is laundered as well... So it really doesn't matter which one you use: $_POST[$key], $this->validation->$key or $this->input->post($key), they're all the same.




Theme © iAndrew 2016 - Forum software by © MyBB