/    Sign up×
Community /Pin to ProfileBookmark

javascript to php

how do i get the output of a javascript and link it to PHP?…

i am using the lottery picker given by the dynamic drive website and i hav probs putting the figure of the output to my php…

the javascript of the lottery picker is such that after letting the lottery picker run…a set of number would be shown….i need to link the figures tp my php…

does anyone hav ideas about wat it is abt?

here is the javascript given by dynamic drive…..
how do i post the results…lets say a single digit “6” given by the javascript and post it to the php script…
cos the concept that i hav was tat….random numbers of 1 to 6 will be given….tat would indicate the amount of hints that i will allow a player to hav,
and lets say…..6 was the given output…
a player would hav 6 hints….and i need to link that output…to php….which means the player would only hav 6 trys

HELP!!!

[QUOTE]

<style type=”text/css”>
.a1{
position:relative;
font-family:Verdana;
font-size:20px;
color:#888888;
}
</style>

<script language=”JavaScript”>

/*****************************************
*
Lottery Picker (By Kurt at [email][email protected][/email])
* Featured on/available at [url]http://www.dynamicdrive.com/[/url]
*
Modified by DynamicDrive.com for below config options
* This notice must stay intact for use.
*
**
**************************************/

var totalnumbers=1 //input total numbers to generate
var lowerbound=1 //input lower bound for each random number
var upperbound=6 //input upper bound for each random number

function lotto(){
B=’ ‘;
LottoNumbers=new Array();
for (i = 1; i <= totalnumbers; i++)
{
RandomNumber = Math.round(lowerbound+Math.random()*(upperbound-lowerbound));
for (j = 1; j <= totalnumbers; j)
{
if (RandomNumber == LottoNumbers[j])
{
RandomNumber=Math.round(lowerbound+Math.random()*
(upperbound-lowerbound));
j=0;
}
j++;
}
LottoNumbers[i]=RandomNumber;
}
LottoNumbers=LottoNumbers.toString();
X=LottoNumbers.split(‘,’);
for (i=0; i < X.length; i++)
{
X[i]=X[i]+’ ‘;
if (X[i].length==2)
X[i]=’0’+X[i];
}
X=X.sort();
for (i=0; i < X.length; i++)
{
OutPut=B+=X[i];
}
if (document.all)document.all.layer1.innerHTML=OutPut;
if (document.getElementById)document.getElementById(“layer1”).innerHTML=OutPut;
if (document.layers){
document.layers.layer1.document.open();
document.layers.layer1.document.write(“<span style=’position:absolute;top:0px;left:0px;font-family:Verdana;font-size:20px;color:#888888;text-align:center’> “+OutPut+”</span>”);
document.layers.layer1.document.close();
}
T=setTimeout(‘lotto()’,20);
//window.status=OutPut;
}
function StOp(){
setTimeout(‘clearTimeout(T)’,1000);
}
//–>
</script>

</body>
<table border=’0′ width=250 height=50>
<tr valign=’middle’>
<td align=’center’>
<form name=form method=”post” action=”lotresults.php”>
<input type=button value=’Lottery Number Picker’ onClick=”lotto();StOp()” >
<input name=”layers”>

<span id=layer1 class=a1>Results</span></form>

[/QUOTE]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@NaldzNov 18.2006 — What exactly do you mean by linking javascript to php?
Copy linkTweet thisAlerts:
@nakawaiiauthorNov 18.2006 — as in the output of the javascript....how can i post or get the result to a php script?
Copy linkTweet thisAlerts:
@mjdamatoNov 18.2006 — Have the javascript change the window.location appending the result to the url like this:

window.location = "http://www.somephpfile.php?jsresult=theresult";
×

Success!

Help @nakawaii spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...