Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

coding problems in PHP

Status
Not open for further replies.

bulletz

Technical User
Dec 4, 2003
2
US
good day!

i have a problem guys, how will i attach a string of data(gathered from a form) at the the end of an http request?

see below for clearer scenario:

html form has these variables:

- bmonth
- bday
- byear

when submitted call a PHP file using form's action="sample.php";

then string together those variables in mm/dd/yyyy format in PHP

$bdate = $bmonth . "/" . $ bday . "/" . $byear;

now, how will i submit this variable including this url " to a remote server?


thanks in advanced
 
Code:
[URL unfurl="true"]http://www.domainname.com/file.jsp?xmldate='.$bdate.'[/URL]
That will carry the string to file.jsp as the variable $xmldate.

If that's not what you wanted to know, then I don't know what you're after. But I think that's what you were after.

Tony
 
In your form tag add onsubmit="send_date(this);" like this:

Code:
<form onsubmit=&quot;send_date(this);&quot; name=&quot;frmMain&quot;>
    <input type=&quot;text&quot; name=&quot;month&quot;>
    <input type=&quot;text&quot; name=&quot;day&quot;>
    <input type=&quot;text&quot; name=&quot;year&quot;>
<form>

Then in the <head> section of your page add this:

Code:
<script language=&quot;JavaScript&quot;>
    function send_date(thisForm)
    {
        document.location = &quot;[URL unfurl="true"]http://www.domainname.com/file.jsp?xmldate=&quot;[/URL] + thisForm.month.value + &quot;/&quot; + thisForm.day.value + &quot;/&quot; + thisForm.year.value;
    }
</script>

That should do what you want. It would be cleaner if your JSP file would parse the form directly, instead of requiring you to accept the date through the URL, of course.


Take Care,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top