Welcome Guest, Not a member yet? Register   Sign In
Pop up box/window
#1

[eluser]the_unforgiven[/eluser]
Just wondered if some one can help me:

I have a link lets say

Code:
<a href="">See meetings</a>

Once this link is clicked it needs to open a box/popup with some php data inside

like so
Code:
<fieldset id='meeting'>
      &lt;?php
    $datemeet = array(
        'name'        =>  'MeetingDate',
              'value'       =>  $meeting->MeetingDate,
              'readonly'    => 'readonly'
    );
    $timemeet = array(
      'name' => 'MeetingTime',
      'value' => $meeting->MeetingTime,
      'readonly'    => 'readonly'
    );
    $remarkmeet = array(
      'name' => 'Remarks',
      'value' => $meeting->Remarks,
      'readonly'    => 'readonly'
    );
    $cutmeet = array(
      'name' => 'Cuttings',
      'value' => $meeting->Cuttings,
      'readonly'    => 'readonly'
    );
    
    
    if ($query->AutoKey === $query->AutoKey) {
    foreach ($query as $meeting)
    {
   ?&gt;
   <table>
   <tr><td>Meeting Date:</td><td>&lt;?php echo form_input($datemeet); ?&gt;</td></tr>
   <tr><td>Meeting Time:</td><td>&lt;?php echo form_input($timemeet); ?&gt;</td></tr>
   <tr><td>Remarks:</td><td>&lt;?php echo form_textarea($remarkmeet); ?&gt;</td></tr>
   <tr><td>Cuttings:</td><td>&lt;?php echo form_textarea($cutmeet); ?&gt;</td></tr>
   &lt;?php } } else { echo ' No records found'; } ?&gt;
   </table>
   </fieldset>

So that all the above php code would show in a window or popup I understand javascript is one way to do it but i cant get the syntax right to display the php, can anyone help??
#2

[eluser]Jason Stanley[/eluser]
You using jQuery?

Code:
$('#someId').click(function(e) {
  e.preventDefault();
  $.ajax({
    'location':'some_controller/path',
    'success':function(html) {
        $('body').append(html);
    }
  });
});

Then just make some controller to output the code you pasted above. The click is clicked, jQuery catches the action and loads whatever is in your control. You can then use CSS to make sure it appears as a pop up.
#3

[eluser]the_unforgiven[/eluser]
the code above php part is one one page so the controller path wont work cos its already in the home controller method
#4

[eluser]Jason Stanley[/eluser]
What, so the code you want to display in the popup is already on the page you are viewing? Its hidden?

Code:
$('#someId').click(function(e) {
  e.preventDefault();
  $('#myContent').show();
});
#5

[eluser]the_unforgiven[/eluser]
thats something i need

Code:
$('#someId').click(function(e) {
  e.preventDefault();
  $('#myContent').show();
});

cheers Jason
#6

[eluser]the_unforgiven[/eluser]
In fact no thats not it needs to a be a pop up box like the alert function in javascript

Im using a twitter style login dropdown at the moment but i need to show in a box so they can click ok to remove the box from the screen
#7

[eluser]Jason Stanley[/eluser]
Then make it a pop up box with CSS... You can't alert HTML obviously...

Wrap your html.

Code:
#wrapper {
  background:white;
  border-radius:5px;
  display:absolute;
  padding:5px;
  top:20%;
  left:40%;
  width:20%;
  z-index:2;
}
#8

[eluser]the_unforgiven[/eluser]
it is wrapper in a id for css,

i kinda want the lightbox thingy jquery does, but need to display php inside it
#9

[eluser]the_unforgiven[/eluser]
think this should do the trick?

http://www.queness.com/post/77/simple-jq...w-tutorial
#10

[eluser]Jason Stanley[/eluser]
I really don't understand what you don't get. PHP needs to be processed. So you either hide it and the code is processed when the page load's. Or you stick it somewhere else and make a call using AJAX. The code will then be processed when the call is made and HTML will be sent.

If PHP isn't processed then you are just sending it as a string which does nothing.

CSS controls the style of a website. If you want a pop up, make a fancy pop up box in CSS then add a class/id to whatever you want to turn into a pop up.

If you want to fade out the background add an overlay.

Code:
<div class="overlay"></div>

Code:
.overlay {
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:#000;
  opacity:0.5;
  z-index:1;
}

This has nothing to do with PHP




Theme © iAndrew 2016 - Forum software by © MyBB