Showing a form over the top of a page
Just wondering what sort of thing I would need to look in to in order to load a form like an 'Are you sure?' type box over the top of a webpage leaving the webpage inaccessible until yes or cancel is clicked?
Using HTML with PHP so would need to adapt it with this
Re: Showing a form over the top of a page
PHP is serverside language. So whatever it do is done at the server and the output is viewed by the user. So at client side, use javascript (maybe jQuery) to do this.
Here's some examples:
:wave:
Re: Showing a form over the top of a page
Thanks,
I'm implementing the code.
I have a submit button:
<form method="POST" action="action-user.php?act=addtr">
<input class="loginbox" name="newinvdesc" type="text" size="23" maxlength="15" />
<input border="0" src="img/button-submit.gif" name="Submit" value="Submit" type="image" onclick="showhide2(this, 'txt1','hide');">
</form>
I have a function:
Code:
<script type="text/javascript">
function showhide2(what,obj,which) {
alert("Your desc is " . $_POST['newinvdesc']);
}
</script>
I want to check the data fields are input and if not stop the form from 'POST' to action-user.php.
Which leads to 2 questions..
how do I get the value of a field since _POST and _GET won't work?
how do I stop the post continuing since exit; doesn't stop it?
Thanks
Re: Showing a form over the top of a page
Don't confuse PHP with JavaScript. To access the value of an element via JavaScript, you can do it by getElemenetById(). Or make use of the jQuery that provides several selectors.
For example, to access an input element with id "myname", you can use the following in jQuery:
For more, google it.
:wave: