473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Passing a value from php to "form"

I need to pass a variable from a php function to a form. Does anyone have an example of code that would do this?

Below is the code. I need to pass the "return value" from the php function mem_cost to the "amount" listed in the "form"

Expand|Select|Wrap|Line Numbers
  1.  <?php 
  2. function mem_cost()
  3. {
  4. $w_month = strftime("%m");
  5.  
  6. if (($w_month >= "01") && ($w_month <= "06"))
  7.         {
  8.         $amt = "30.00";
  9.         return $amt;
  10.         }
  11. else
  12.         {
  13.         $amt = "60.00";
  14.         return $amt;
  15.         }
  16. }
  17. ?>
  18.  
  19. <form target="bridge-data" action="https://www.nowhere.com/display.html" method="post">
  20. <input type="image" src="http://www.nowhere.com/image/btn/btn01.gif" border="0" name="submit" alt="Press here for to purchase item">
  21. <img alt="" border="0" src="http://www.nowhere.com/image/pixel.gif" width="1" height="1">
  22. <input type="hidden" name="add" value="1">
  23. <input type="hidden" name="cmd" value="_cart">
  24. <input type="hidden" name="business" value="xxx1@nowhere.com">
  25. <input type="hidden" name="item_name" value="Membership Dues">
  26. <input type="hidden" name="item_number" value="4600">
  27. <input type="hidden" name="amount" value="needs to be return value from fuction">
  28. <input type="hidden" name="buyer_credit_promo_code" value="">
  29. <input type="hidden" name="buyer_credit_product_category" value="">
  30. <input type="hidden" name="buyer_credit_shipping_method" value="">
  31. <input type="hidden" name="buyer_credit_user_address_change" value="">
  32. <input type="hidden" name="no_shipping" value="0">
  33. <input type="hidden" name="no_note" value="1">
  34. <input type="hidden" name="currency_code" value="USD">
  35. <input type="hidden" name="lc" value="US">
  36. <input type="hidden" name="bn" value="Cart">
  37. </form>
  38.  
Sep 6 '07 #1
1 1784
ak1dnar
1,584 Expert 1GB
check this out !
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="amount" value="<?Php echo mem_cost(); ?>">
Sep 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Davis | last post by:
I want to know what's the differences between Request.Form("Field Name") and Request.QueryString("Field Name") OR they function exactly the same, which is to return the value of the field?? ...
1
by: David Bradbury | last post by:
Hi On my form, as soon as the user clicks my submit button a message pops up saying "Form processing" as the form submits. This is fine as long as the user only clicks the submit button once....
3
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their...
5
by: Werner Partner | last post by:
On my testpage http://www.sonoptikon.de/test.php I have this <table><tr> <td valign="top" align="center" style="width:150px;"> <form action=test.php method="get">
5
by: John Oliver | last post by:
I'd like the email produced by FormMail to show a specific From: address rather than postmaster@server.host.name Googling isn't helping me... not sure what to look for :-( -- * John Oliver ...
3
by: IMRAN SAROIA | last post by:
Hi, I am passing file through aspSmartUpload by using input file form control in my form. But I cannot use Request.Form("Variable") command in my called asp. And it says you cannot use it...
8
by: abcd | last post by:
I can get the value on the form at the server side by using Request.form("max") when max field is disabled I dont get value. For GUI and business logic purpose I have disabled some fields with...
6
by: Deano | last post by:
Every once in a while I modify one particular form (could be anything from adding code to tweaking properties as far as I can see) and upon loading I get; "You can't assign a value to this...
0
by: David | last post by:
Hi, I have an asp page which lists records. Each record has an ID appended to it. On the following edit page, I am trying to test against a certain field value, if it is >0 then run the update,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.