Jump to content

php $_Post difficulty


gtsown

Recommended Posts

Hello everyone,

I'm a bit of a newbie/intermediate at php and i'm trying to figure out $_Post, while using it on an e-commerce site. Nothing too advance, just a system that works with gateway processor. I've created the form and setup connections to the gateway. As of right now, the gateway processor is pre made and cannot customize their fields. However, there are two fields which anything can be pass into, ($email_header and $email_footer)

 

I'm sure someone knows how to do this.

 

I basically want to call one of the input fields that is entered on the form and pass that info into the header variable.

 

for example i tried using the birth field:

 

$birthdate = $_POST['birth'];

$email_header="Name: " . $birthdate . "<br>";

 

Nothing happens except when i receive the email confirm, i get: Name: br.

 

here is the code i've been working on...

thank you in advance..

 

 

<?php
    //Gateway connection information
    $account="0000000000";
    $service_type_code="000000000000";
    $connecting_site_code="0000000000000";
    //Transaction ID - for tracking on your end
    $transaction_id="3435";
    //Description of the Charge
    $transaction_desc="Continuing Education Transaction";
    //How much to charge the card
    $charge_amount="0";
    //Your CGI Script that receives the response from gateway processor  
    $post_back_url='http://www.post_back_url.php';    
    //Should customer receive a Credit Card Charge receipt via email?  
    $email_ind="TRUE";  
    //Should a person on staff that get copies of the Credit Card Charge receipt via email?
    $merchant_email_ind="TRUE";  
    //Person on staff that gets copies of the Credit Card Charge receipt via email
    $merchant_email="unknown@thisemail.com";
    //Header of the Credit Card Charge receipt
    
    $birthdate = $_POST['birth'];
    $email_header="Name: " . $birthdate . "<br>";
    
    //Footer of the Credit Card Charge receipt  
    $email_footer="Test Site";  
    
    //Variables to determine how the page displays
    //CSS Setup
    $FormFormat="horizontal2";
    $HeaderHtmlPaymentForm= "<img src=http://img_src.gif width=697 height=154 alt=udeworld logo/> <h1>Payment Section</h1>";
    $FooterHtmlPaymentForm="<p> Please be patient. If you click the submit button more than once, you will be charged again. <br /><br /><br /></p>";
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form name = "process" action="https://processatgateway.php"
method="post" onSubmit="return CheckRequiredFields();
if(document.getElementById('payment_form_submit').disabled){alert('form already submitted, please wait.');
return false;}else{document.getElementById('payment_form_submit').disabled=true; return true;}" >

<div class="title">Please enter your personal information</div>
<table border="0" cellpadding="0" cellspacing="0" width="100%" summary="layout" class="layout">
<tr>
<td align="right"><p>First Name</p></td>
<td><p>    <input type="text" maxlength="30" size="30" name="first_name" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Last Name</p></td>
<td><p>    <input type="text" maxlength="30" size="30" name="last_name" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Street Address</p></td>
<td><p>    <input type="text" maxlength="100" size="50" name="street_address" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>City</p></td>
<td><p>    <input type="text" maxlength="30" size="20" name="city" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>State</p></td>
<td><p>    <input type="text" maxlength="30" size="20" name="state" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Zip Code</p></td>
<td><p>    <input type="text" maxlength="10" size="10" name="zipcode" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Country</p></td>
<td><p>    <input type="text" maxlength="30" size="30" name="country" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Telephone</p></td>
<td><p>    <input type="text" maxlength="20" size="20" name="home_phone" value="" /></p></td>
<tr>
<td align="right"><p>Birth Date</p></td>
<td><p>    <input type="text" maxlength="20" size="20" name="birth" value="" /></p></td>  
</tr>
<tr>
<td align="right"><p>Profession</p></td>
<td><p>    <SELECT NAME="profession">
<OPTION VALUE="p1">Architect</OPTION>
<OPTION VALUE="p2">Landscape Architect</OPTION>
<OPTION VALUE="p3">City Planner</OPTION>
<OPTION VALUE="p4">Developer</OPTION>
<OPTION VALUE="p5">Public Official</OPTION>
<OPTION VALUE="p6">Consumer Advocate</OPTION>
<OPTION VALUE="p7">Educator</OPTION>
<OPTION VALUE="p8">Student</OPTION>
<OPTION VALUE="p9">Other..Please Specify below</OPTION>
</SELECT></p></td>
</tr>
<tr>
<td align="right"><p>Other</p></td>
<td><p>    <input type="text" maxlength="50" size="50" name="other" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Email Address</p></td>
<td><p>    <input type="text" maxlength="200" size="50" name="email" value="" /></p></td>
</tr>
<tr>
<td align="right"><p>Comments</p></td>
<td><p>    <textarea name="additional_comments" cols="50" rows="4" maxlength="50" ></textarea></p>
</td>
</tr>
<tr>
<td>
    
</td>
<td>
<p>    <input type="submit" value="Proceed to Credit Card Payment Form" id="payment_form_submit" name="payment_form_submit" />
<input type="reset" value="Reset"/>
</p>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<input type="hidden" name="ubf_account" value="<?=$ubf_account?>" />
<input type="hidden" name="service_type_code" value="<?=$service_type_code?>" />
<input type="hidden" name="connecting_site_code" value="<?=$connecting_site_code?>" />
<input type="hidden" name="transaction_id" value="<?=$transaction_id?>" />
<input type="hidden" name="transaction_desc" value="<?=$transaction_desc?>" />
<input type="hidden" name="charge_amount" value="<?=$charge_amount?>" />
<input type="hidden" name="post_back_url" value="<?=$post_back_url?>" />
<input type="hidden" name="merchant_email" value="<?=$merchant_email?>" />
<input type="hidden" name="email_ind" value="<?=$email_ind?>" />
<input type="hidden" name="merchant_email_ind" value="<?=$merchant_email_ind?>" />
<input type="hidden" name="email_header" value="<?=$email_header?>" />
<input type="hidden" name="email_footer" value="<?=$email_footer?>" />
<input type="hidden" name="HtmlTitle" value="<?=$HtmlTitle?>" />
<input type="hidden" name="FormFormat" value="<?=$FormFormat?>" />
</form>
</td>
</tr>  
<tr><td>
</td></tr>
</table>
</html>

Link to comment
Share on other sites

If only "Array()" is printed out, that means that the array is empty. Since I don't see any obvious mistakes, my guess is that the action on your form is pointing to a different location than you think it is. I am not familia with ssl, but I would assume you can't use the https protocal to a relative location of a file. Try just "processatgateway.php" for the action.

Link to comment
Share on other sites

The form is being submitted to the gateway processor. 

All i need is to have the fields which are not declared as a variable by the processor be processed in the $email_header.

 

I don't need any of the info posted onto another page.

 

I just don't understand why the name="birth" in the input field wouldn't be read or processed once its is declared.

 

$email_header in the return email is reading whatever "string" in place into it.

 

Don't if I'm explaining this correctly..

Link to comment
Share on other sites

it is going to another file, but that file is controlled by the gateway processor. I don't have access to that file. If i had access to that file then i would have no problem. Fields such as Name, City, are already being collected in the processor, processed and sent to the user as a confirmation.  I'm trying to call some of the fields that are not initialized by the processor into $email_header.

 

it feels like I'm not explaining this right. so here is the actual setup.

 

here's what the site looks like: http://www.udeworld.com/education/form.php

you have to enter an email address for the form to go the credit card payment.

use this information when you reach the credit card purchaser: Visa - 4007000000027 and any expiration date.

 

the email which is sent to you leaves out a few of the fields, those fields because the gateway processor customizable are not being sent in the email.  Those fields from the form could technically be parsed into the $email_header variable. Maybe i have to identify what fields by using some sort of php code.

 

thanks for your responses...

Link to comment
Share on other sites

For you to use the variables from the page you don't have access to, it has to send them to your page, which it doesn't seem like it is doing. If it doesn't put the variables somewhere for you, you can't use them. To see if they are getting sent to your file, somehow, print all the possible variables.

print_r($_POST);
print_r($_GET);
print_r($_SESSION);

 

Look through those outputs and see if there is anything you can use.

Link to comment
Share on other sites

Hello everyone,

Thank you guys for your reply, i was able to figure out the original problem, with some help of course.

 

Now i have another issue...anyone know how to submit data to a database and an e-commerce gate at the same time.  Say for example, after the user selects a product, enters all of the necessary information, a page is echo to them, giving them a chance to review the information they have submitted. When they push the submit button, I would like the data entered be sent to the data base and the next screen be the credit card gateway screen. 

 

I can do this independently, but at moment not simultaneously!

 

any help would be appreciated....

 

Thanks in advance...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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