Jump to content

Popup Form for each result from mysql database


visualazza

Recommended Posts

Ive been racking my brain(s) for a while now about this.

 

Does anyone know how i would go about setting up a system to create a popup box with a form inside that will have a unique id (retrieved from the database) in a hidden field for each result of a query, that when sent will perform a task related to the row with the unique id?

 

Thanks,

Kind Regards,

Ashley

Link to comment
Share on other sites

i should also mention that i have created the popup content area, but im just trying to parse the id number to a hidden field on that form depending on which results link to open the popup area.

 

Oh and yes you are right MrAdam.

 

Just to clarify the popup box works like shadow box without opening another window.

Link to comment
Share on other sites

it uses jquery and its not the whole code

 

function loadPopup(){

//loads popup only if it is disabled

if(popupStatus==0){

$("#backgroundPopup").css({

"opacity": "0.7"

});

$("#backgroundPopup").fadeIn("slow");

$("#popupContact").fadeIn("slow");

popupStatus = 1;

}

}

 

This is when you click the link or button

$("#button").click(function(){

//load popup

loadPopup();

});

Link to comment
Share on other sites

I'd reccommend selecting the buttons using a class name, as apposed to the ID (you shouldn't have multiple elements with the same ID anyway). That way you can then store the unique ID in question as the ID of the element, and then pass that to the loadPopup() function:

 

   $(".popupButton").click(function(){
      //load popup
      loadPopup(this.id);
   });

 

Then declare the ID parameter in your function:

 

function loadPopup(the_id){ // with a more fitting name of course

 

Now you have the unique ID available within the function. Just select the hidden input and update it's value..

 

This method may be a little fallible just plainly storing the ID like that, so you may want to prepend it with "result:" or something and strip that part out in the function.. your call.

Link to comment
Share on other sites

Well I assume the pop-up box HTML already exists in the document, judging by the code? You just need to select the hidden input you wish to store the ID in using jQuery's selector and set the value property:

 

$('#hidden_input_id').value = the_id;

Link to comment
Share on other sites

No, think about CSS. "#" means an ID, although you'll want to use something a little more meaningful than "hidden_input_id".

 

Edit: But yeah, you need to add it to the unique ID hidden field in your form.

Link to comment
Share on other sites

yeah, sorry, i meant id.

 

I think ive got it to work.

 

Thanks ever sooo much. If ever you need help with anything with graphics such as banner or logos, video (with vfx) or any music or sounds then im your man. For all your help you can have anything you want.

 

Thanks again

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.