logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 02-18-2013, 05:53 PM   #1
cocoonfx
cocoonfx's Avatar
 
Join Date: Nov 2006
Location: Tamworth,UK
Posts: 576
Default PHP form to open colorbox

Hi I am a little stuck with a PHP form and a lightbox. I can get the light box to work if I have a second link to fire the lightbox. My aim is to use just the submit button. Has anyone got any ideas on how to do this?

HTML Code:
<script type="text/javascript" src="<?php echo get_template_directory_uri();?>/js/jquery.colorbox-min.js"></script>
<script type="text/javascript">

            $(document).ready(function(){

                 $(".inline").colorbox({inline:true, width:"50%"});

            });

        </script>
PHP Code:
<?php
$num1 
$_POST['num1'];
$num2 $_POST['num2'];
$a $num1*$num2;


;
?>
<form name="form1" method="post" action="">

    <label for="textinput">Your Hourly Rate</label>
    <br />
    <input type="text" id="textinput" name="num1" class="textinput" maxlength="25" />
    <br />
    <label for="textinput2">Hours a day spent on admin</label>
    <br />
    <input type="text" id="textinput2" name="num2" class="textinput" maxlength="25" />
    <br />
         
           <input type="submit" id="submit" name="submit" value="Submit" />
            
           <p><a class='inline' href="#inline_content">ttt</a></p>
       
        </form>

        <!-- This contains the hidden content for inline calls -->
        <div style='display:none'>

            <div id='inline_content' style='padding:10px; background:#fff;'>

               <?php echo $a?>

            </div>

        </div>
cocoonfx is offline   Reply With Quote
Old 02-21-2013, 06:31 PM   #2
gentleone
gentleone's Avatar
 
Join Date: Nov 2009
Location: Rhodes, Greece
Posts: 2,837
Default

You can use the .submit() event in jQuery. Here's a thread on Stackoverflow with an answer that should get you there:
http://stackoverflow.com/questions/7...answer-7737235
__________________
www.gentlemedia.nl
gentleone is offline   Reply With Quote
Old 03-11-2013, 05:08 AM   #3
jmichae3
 
Join Date: Dec 2010
Posts: 366
Default

are you sure would would not rather use input type="button" onclick="somefunc()" and then simply not use something that's going to submit the whole form contents over the web? if this is the intended purpose, then go for it. otherwise, simpler less internet-based DHTML might be faster and better, not going over the internet (processing locally in the browser only).
also understand that stackoverflow content is licensed.
__________________
------------
Jim Michaels
HTML Code:
improperly<strong>nested<em>elements</strong>cause</em>
browser confusion (I believe the term is 'tag soup')!
jmichae3 is offline   Reply With Quote
Old 04-05-2013, 07:51 AM   #4
jmichae3
 
Join Date: Dec 2010
Posts: 366
Default

that first block of code should be a .php file, but you probably already knew this, I wondered about the first box of code since it's an HTML box and not PHP.
view the source code via the browser of your existing page and see if that PHP chunk is being executed properly.

also, do you want .inline (the entire class of CSS, every instance that uses this) or #inline (for a specific id)?

please explain the documentation for .colorbox(), I don't see it in jquery. it is not in danny goodman's javascript bible 7th ed, index.
http://api.jquery.com/?s=.colorbox
__________________
------------
Jim Michaels
HTML Code:
improperly<strong>nested<em>elements</strong>cause</em>
browser confusion (I believe the term is 'tag soup')!
jmichae3 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:08 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com