Re: Preview in a new window

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It looks like you're missing a combination of things and,  
structurally, you're getting goofed between your javascript and php.

To start with, your onclick needs to have the PHP spewing out your info.

So it would look something like this:
onclick="<?php echo newWindow(); ?>"

The newWindow function, though, is a problem in and of itself. It's  
some weird combination of javascript and php, and not really either.

It looks like what you need to do is build your window.open() stuff  
as a string in php, then echo it out to the screen at the onclick.

So, in the end, your code will probably be something closer to this,  
but I'd have to check on the javascript:
<?php
...
$foo = 'window.open 
("bbbb.php","width=400,height=500,top=50,left=280,resizable,toolbar,scro 
llbars,menubar")';
...
?>
...
<input type="submit" name="Preview" value="Preview" onclick="<?php  
echo $foo; ?>" />


If you add your click script to a variable to export (in this case  
$foo), it will also make things easier to build on/modify if you  
decide you need to build a javascript function of a different nature  
that gets dumped to the onclick.
--
Joe



On Sep 22, 2008, at 8:02 AM, Sabs wrote:

> Hi guys,
> I have a small question... I have a simple form where user can  
> enter data.
> I have two button. One to submit and add the data and the other one to
> preview the data...is there a simple way to do it...
>
> =====================================================
> i tried smthing like this... but doesnt seem to work:
>
> <?php
> function newWindow() {
> window.open("bbbb.php, "", "width=400,height=500,top=50,left=280,
> resizable,toolbar,scrollbars,menubar,");
> }
> ?>
>
> <form action="aaa.php" method="post" >
> ....
> <input type="submit" name="Preview" value="Preview"  
> onclick="newWindow();" />
> <input type="submit" name="Add" value="Add" />
> </form>
> ======================================================
> any suggestion will be appreciated
>
> best
> _sabs


[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux