By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,609 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

Help with variables and POST

P: n/a
Hello,

Can anyone help with this?

On my online order form, I need to send a few variables to my
credit-card processor. These variables are for non-secure customer
comments, and will be sent through the usual metod, i.e.,
<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

However, one variable is a text-area box for a detailed customer
comment, and this variable can get pretty long. But my credit-card
processor has a 256 byte maximum length limit for all POSTed
variables. However, I can add as many of these 256-byte variables as I
like.

So how can I accomplish this in the most simple, efficient, and
elegant manner? How can I break up the text-area vaiable into 256-byte
pieces and then send these variables via POST along with all of the
other form variables which will be POSTed through the usual HTML
means?

Thank you.

Sincerely,

Robert

If you reply directly to this question, please send to
ro********@starcenter.com .
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
red
Robert wrote:
Hello,

Can anyone help with this?

On my online order form, I need to send a few variables to my
credit-card processor. These variables are for non-secure customer
comments, and will be sent through the usual metod, i.e.,
<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

However, one variable is a text-area box for a detailed customer
comment, and this variable can get pretty long. But my credit-card
processor has a 256 byte maximum length limit for all POSTed
variables. However, I can add as many of these 256-byte variables as I
like.

So how can I accomplish this in the most simple, efficient, and
elegant manner? How can I break up the text-area vaiable into 256-byte
pieces and then send these variables via POST along with all of the
other form variables which will be POSTed through the usual HTML
means?

Thank you.

Sincerely,

Robert

If you reply directly to this question, please send to
ro********@starcenter.com .

in the example below,input(), form() and html() are my own functions (I
hate writing html) but its obvious what they do so I won't show
them.This is enough to give you the idea.

$data = str_split($_POST[text_area_data],256);
$num=0;
foreach($data as $d){
$name="comment_part_$num";
$num++;
$fields.=input('hidden',$name,$d);
}
$fields.=input('submit','submit','submit');
$action= "credit_card_processor.php";
$form=form($fields,$action);
html($form);
Jul 17 '05 #2

P: n/a
red <gr*****@reenie.org> wrote in message news:<wm**********************@news.easynews.com>. ..
Robert wrote:
Hello,

Can anyone help with this?

On my online order form, I need to send a few variables to my
credit-card processor. These variables are for non-secure customer
comments, and will be sent through the usual metod, i.e.,
<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

However, one variable is a text-area box for a detailed customer
comment, and this variable can get pretty long. But my credit-card
processor has a 256 byte maximum length limit for all POSTed
variables. However, I can add as many of these 256-byte variables as I
like.

So how can I accomplish this in the most simple, efficient, and
elegant manner? How can I break up the text-area vaiable into 256-byte
pieces and then send these variables via POST along with all of the
other form variables which will be POSTed through the usual HTML
means?

Thank you.

Sincerely,

Robert

If you reply directly to this question, please send to
ro********@starcenter.com .

in the example below,input(), form() and html() are my own functions (I
hate writing html) but its obvious what they do so I won't show
them.This is enough to give you the idea.

$data = str_split($_POST[text_area_data],256);
$num=0;
foreach($data as $d){
$name="comment_part_$num";
$num++;
$fields.=input('hidden',$name,$d);
}
$fields.=input('submit','submit','submit');
$action= "credit_card_processor.php";
$form=form($fields,$action);
html($form);


Thank you for the reply. However, could you explain the input(),
form() and html()functions?

Sincerely,

Robert
ro********@starcenter.com
Jul 17 '05 #3

P: n/a
Robert wrote:
red <gr*****@reenie.org> wrote in message news:<wm**********************@news.easynews.com>. ..
Robert wrote:
Hello,

Can anyone help with this?

On my online order form, I need to send a few variables to my
credit-card processor. These variables are for non-secure customer
comments, and will be sent through the usual metod, i.e.,
<form action="https://orderpage.ic3.com/hop/orderform.jsp"
method="post">

However, one variable is a text-area box for a detailed customer
comment, and this variable can get pretty long. But my credit-card
processor has a 256 byte maximum length limit for all POSTed
variables. However, I can add as many of these 256-byte variables as I
like.

So how can I accomplish this in the most simple, efficient, and
elegant manner? How can I break up the text-area vaiable into 256-byte
pieces and then send these variables via POST along with all of the
other form variables which will be POSTed through the usual HTML
means?

Thank you.

Sincerely,

Robert

If you reply directly to this question, please send to
ro********@starcenter.com .
in the example below,input(), form() and html() are my own functions (I
hate writing html) but its obvious what they do so I won't show
them.This is enough to give you the idea.

$data = str_split($_POST[text_area_data],256);
$num=0;
foreach($data as $d){
$name="comment_part_$num";
$num++;
$fields.=input('hidden',$name,$d);
}
$fields.=input('submit','submit','submit');
$action= "credit_card_processor.php";
$form=form($fields,$action);
html($form);

Thank you for the reply. However, could you explain the input(),
form() and html()functions?


They just write html tags. Sorry, I assumed you already knew how to do
that.
A form has input statments to gather data to send to the next page.

A)
$data = str_split($_POST[text_area_data],256);
This gets the data from the previous page, devides the data into 256
byte chinks and puts the chunks into the $data array.

B)
$num=0;
foreach($data as $d){
$name="comment_part_$num";
$num++;
$fields.=input('hidden',$name,$d);
}
This loop iterates through the $data array and makes each piece of data
the value of a hidden field in an input statement. It essentially does
something like this:
$fields.="<input type='hidden' name='comment_part_3' value='$d'>";
where $d is one 256 byte chunk of data. Each hidden field is given a
unique name: comment_part_0,comment_part_1,comment_part_2 etc.

C)
$fields.=input('submit','submit','submit');
this adds a submit button: "<input type='submit' name='submit'
value='submit'>

D)
$action= "credit_card_processor.php";
$form=form($fields,$action);
This puts the hidden fields and the submit button between form tags with
the action set to the file that will process your data.
$form="<form action = 'credit_card_processor.php'> $fields</form>";

E)

html($form);
This adds html tags to the argument . It does other things so that the
page validates, but we don't need to get into that to answer your question.
Sincerely,

Robert
ro********@starcenter.com

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.