[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Send date to php page

Posted on 2011-03-01
10
Medium Priority
?
485 Views
Last Modified: 2012-05-11
Hi, this form send the date to alert and works fine. I will send data to a php page and put the value(date) in a variable like : $variable="date_value"
<form>
    <script>DateInput('orderdate', true, 'DD-MON-YYYY')</script>
    <input type="button" onclick="alert(this.form.orderdate.value)" value=" Send date " />
</form>
0
Comment
Question by:sam20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 14

Accepted Solution

by:
Kalpan earned 1000 total points
ID: 35004844
you can use the jquery to pass to hidden variable and then use that value to submit the value....

Please refer the example

<script>
odate  = DateInput('orderdate', true, 'DD-MON-YYYY');
$(document).ready(function(){
  $("#orderdate").html(odate);
});
<script>

<form action="somepage.php"  method="post">
    <input type="hidden" id="orderdate" name="odate" value=""/>
    <input type="button" onclick="alert(this.form.orderdate.value)" value=" Send date " />
</form>


// some php page...somepage.php

<?php

echo $_POST['odate'];

?>
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35004859
0
 

Author Comment

by:sam20
ID: 35005305
Thanks all for replyes.
I've done that below as kalmax have said but nothing happens.
( I am using separate js file and have this: <head><script type="text/javascript" src="calendarDateInput.js"></script></head>

<form action="page.php"  method="post" target="main">
    <script>DateInput('orderdate', true, 'DD-MON-YYYY')</script>
    <input type="hidden" id="orderdate" name="odate" value=""/>
    <input type="button"  value="  Send date " />
 </form>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:Kalpan
ID: 35005430
you would need to include

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

that will work with jquery and provide the value to hidden field...

0
 

Author Comment

by:sam20
ID: 35005561
It is still as before, nothing happens.
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35005564
@sam20: did you tried what i had suggested?
0
 

Author Comment

by:sam20
ID: 35005605
Hi gruvinder,  I Will read those links that you have sujested
0
 

Author Comment

by:sam20
ID: 35005645
I am using javaScript Calender see please this script: http://www.dynamicdrive.com/dynamicindex7/jasoncalendar.htm
 I will send date to a php page and put the value(date) in a variable, instead of send to alert.
0
 
LVL 40

Assisted Solution

by:Gurvinder Pal Singh
Gurvinder Pal Singh earned 1000 total points
ID: 35005697
@sam20: i dont think it should make any difference. Just submit the hidden date field to server, and php can then read that posted data
0
 

Author Comment

by:sam20
ID: 35005768
You are right gruvinder, I got the value in this way:
<form action="page.php"  method="get" >
    <script>DateInput('orderdate', true, 'DD-MON-YYYY')</script>
    <input type="hidden" id="(this.form.orderdate.value)" name="odate" value=""/>
    <input type="submit"  value="  Send date " />
 </form>
And the page.php
<?php
echo $_GET['orderdate'];
?>

Thanks everybody
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question