Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 18th, 2011, 06:02 AM
Registered User
 
Join Date: Apr 2011
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default text field values to php variable.......

<body>
<?php
function MonthDays($someMonth, $someYear)

{

return date("t", strtotime($someYear . "-" . $someMonth . "-01"));

}
//for example

$someMonth=2; // i want $someMonth=monthtxt.value(Textbox value)
$someYear=2011; // i want $someYear=yeartxt.value(Textbox value)
$d=MonthDays($someMonth, $someYear);
echo $d;


?>

<form name="tt">
month<input type="text" class="contact_input" name="monthtxt" >
<br>
year<input type="text" class="contact_input" name="yeartxt" >
<br>
Total days<input type="text" class="contact_input" name="yeartxt" id="" value="<?php echo $d ; ?>" >
</form>
</body>

how can i pass textbox value to variable without posting page,I need some help.......
 
Old April 18th, 2011, 06:53 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

You can not set php variable from html elements. You must post you page and call process.php page to process your form.

Now a days if you want to process form without posting, then you can use ajax.
XAJAX is ready to use ajax library, download, learn example and implement it in your code.
__________________
urt

Help yourself by helping someone.
The Following User Says Thank You to urtrivedi For This Useful Post:
nayak (April 18th, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Text(Sql Server Text Field) to Image(JPG) srinivas72 ADO.NET 2 February 13th, 2009 06:31 PM
text field values Sheraz Khan Classic ASP Basics 12 January 21st, 2009 09:46 PM
php take get variable and dynamically set values crmpicco PHP How-To 1 October 22nd, 2007 07:19 PM
loop values and text box values move mateenmohd Classic ASP Basics 2 April 5th, 2005 11:33 PM
Pass select values to hidden text field? abq23 Javascript How-To 2 July 20th, 2004 09:47 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.