Results 1 to 4 of 4

Thread: Showing a form over the top of a page

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Posts
    137

    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

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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:


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2006
    Posts
    137

    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

  4. #4
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    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:
    Code:
    $('#myname').val()
    For more, google it.

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width