Jump to content

HTTP_POST_VARS madness!


jeffery1493

Recommended Posts

Hi All, :'(

Although I'm new to PHP, I have been stuck on this problem for several days.  I have a php program referencing a .tpl template (a standard phpBB forum form) which calls another php program- a billing routine that has its own .tpl template.

In other words: In this routine, you enter the info to post a New Topic, and then you click "Pay" and go on to a Pay screen where you are billed.  Both of these parts were written by other people who can't be contacted.



All I've been trying to do is combine the two parts into one form, to cut down on the number of pages. 
That is, I want the data from the Pay form at the bottom of the Topic Entry screen, so they are all together.

I did this by first combining all the data entry on to the same page, and into the same .php program, and then combining the .tpls.  This all works fine.  I then found the point right after "SUBMIT" is clicked in the combined php program (after you have filled out all the data), and inserted this call to the Pay routine php that used to follow the Pay entry form:

echo "<script>location.href='payentryconfirm." . $phpEx."';</script>;


The problem is, the pay data is now going over empty.  The Pay routine refers to the variables as $HTTP_POST_VARS['amount']..........but these variables are now all null.




In the combined template, the variable 'amount' is being set  :'(with:
-----------------
<input type="text" name="amount" class="post".......>


And in the Pay routine, the value is trying to be found with:
-----------------
$amount=floatval($HTTP_POST_VARS)['amount'];


but it comes up blank.  For some reason HTTP_POST_VARS is not working.  I have also tried $_POST and $_GET, to no avail.   

Does anybody have an idea why?????      Would appreciate any advice.....thanks


JEFFERY1493



Link to comment
https://forums.phpfreaks.com/topic/33864-http_post_vars-madness/
Share on other sites

I don't think setting location.href will submit the form values.  Try this:

[code=php:0]document.order_form.submit()[/code]


assuming the form is named "order_form".  And be careful, if you have a form element named "submit" then this will fail!  The only solution there that I know of is to rename the form element.
Do you mean,

<?php

document.depositconfirm.submit();

echo "<script>document.depositconfirm.submit();</script>";

echo "<script>'"document.depositconfirm." . $phpEx'.submit();</script>"; or

document.depositconfirm.submit(fill in some info here)...........



I do have the variable 'submit' all over the place, I suppose I can try a global replace.




<SCRIPT language="JavaScript">document.myform.submit()</SCRIPT>;


I found that here:

http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml


But, it gives me:

Parse error: syntax error, unexpected '<' in /home/u4/jeffery1493/html/phpbb/posting.php on line 586

Unless I

echo "<SCRIPT language='JavaScript'>document.myform.submit()</SCRIPT>";

In which case it just ignores the line entirely




OKAY----

This probably isn't the best way, but it works.

I went into the 2nd php program, and found every place where HTTP_POST_VARS or HTTP_GET_VARS were being used.

I then copied all these HTTP references into the first php, and set their values equal to variables.
I then did a session_start(); and assigned these variables into $_SESSION['variable1'], $_SESSION['variable2'], etc.

I then went into the 2nd php program, put in a session_start() at the top, and read the values back from $_SESSION['variable1'], $_SESSION['variable2'], into variables again.  I then put these variables in the places where the HTTP_POST_VARS and HTTP_GET_VARS had been.    This forced it to work.


**LOL*** 


Well, as they say, Mediocrity:  It takes a lot less time, and most people won't notice the difference until it's too late.




Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.