Jump to content

php in java script or another way to correct my issue


predator12341

Recommended Posts

right i have this code below and what it does is if the ok button is pressed on the java pop up it should carry out the code but i dont no how to do this

if($TimeVisit < $CoverTimeStart || $TimeVisit > $CoverTimeFinish || $TodayDay < 01 || $TodayDay > 05)
{
echo "<script Language=Javascript> var Message = 'This job is a chargable visit because the customer does not have maintenance cover. If you wish to continue click ok.'
if (! confirm (Message))
{
location.href='../Calendar.php'
}

what i need to find out is how i can see if the ok button is pressed in this java script bit so i can carry out the correct code (which is of course php)

</script>";
}
else
{
the code here if the if statment is not met

regards
Pred
Link to comment
Share on other sites


Use a function like the one below, which can be activated onClick.
Have it redirect you to a php url with ?buttonClicked=true on the URL or something like that. ??

Do you really need to use a javascript alert box? would a splash/holding page with the agree/disagree option not do the trick?



[code]<script type="text/javascript">
<!--
function relocate()
{
window.location = "http://www.yourdomain.com/yourpage.php?action=whatever"
}
//-->
</script>

<a href="#" onClick="relocate();">Whatever, I agree without reading stuff anyway.</a>[/code]
Link to comment
Share on other sites

yea but that will not act as me pop up box will it. as what i have is if cancel is clicked it goes back to a different page. however, if ok is clicked and they wat to go ahead with the booking i need it to use this php script (which uses variables declared earlier on so i really want to keep it all in this one page if it is possible)

PS hey again wise wood have a nice weekend. I did lol i got p*ssed out me face a nice way to end the week



echo "<script Language=Javascript> var Message = 'This job is a chargable visit because the customer does not have maintenance cover. If you wish to continue click ok.'
if (! confirm (Message))
{
location.href='../Calendar.php'
}
else
{
from what i can work out i need a way of putting the php in here

}
</script>";
Link to comment
Share on other sites

[code]
<script Language=Javascript>
<!--
function predator12341()
{
var location= confirm("This job is a chargable visit because the customer does not have maintenance cover. If you wish to continue click ok.");
if (location== true)
{
   window.location="yourpage.php?clicked=YES";
}
else
{
  window.location="yourpage.php?clicked=NO";
  }
}
//-->
</script>

<a href="#" onClick="predator12341();">Whatever, I agree without reading stuff anyway.</a>
[/code]

Yeah pretty good weekend... painted the living room ceiling and FINALLY got round to upgrading the pc to XP.

PS. ^^^ That should do it.
Link to comment
Share on other sites

[!--quoteo(post=366427:date=Apr 19 2006, 03:10 PM:name=wisewood)--][div class=\'quotetop\']QUOTE(wisewood @ Apr 19 2006, 03:10 PM) [snapback]366427[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]
<script Language=Javascript>
<!--
function predator12341()
{
var location= confirm("This job is a chargable visit because the customer does not have maintenance cover. If you wish to continue click ok.");
if (location== true)
{
   window.location="yourpage.php?clicked=YES";
}
else
{
  window.location="yourpage.php?clicked=NO";
  }
}
//-->
</script>

<a href="#" onClick="predator12341();">Whatever, I agree without reading stuff anyway.</a>
[/code]

Yeah pretty good weekend... painted the living room ceiling and FINALLY got round to upgrading the pc to XP.

PS. ^^^ That should do it.
[/quote]

with the above the var's i currently have on the page will not be passed on (and i dont wanna pass them on through the url or anything is there any way around this or can i do what i am trying to another way in php)
Link to comment
Share on other sites

Send me a PM with the details of what you're trying to do and i'll see if i can figure out a way of doing it.
Give me an idea what you want the user to be presented with after they say "Yes" on the form, and i'll see what i can come up with.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.