Skip to main content
October 8, 2010
Question

While viewing a detail page, a hidden form submits into a seperate table without having to click...

  • October 8, 2010
  • 2 replies
  • 2340 views

Hello, everyone:

I am having hard time explaining what I want.

Is there a way to insert data into a table without clicking on the submit button.

Let me explain.  I have a table that I want to populate.  In DW4 I have created a list of records.  I click on a link which opens a seperate page showing the details of my choosing.  What I want to do is have a seperate hidden table in my detail page that inserts my record I selected.  In my hidden table which is created by DW4 insert record to add certain information about the user and his/her choice of record.  The problem I am facing is DW4 creates a submit button.

My question is, in my list of records, when I click on a link from the list of records to view my details, how can I insert hidden information to another table without clicking on the submit button (which I do not want anyone to see) while in the detail page without it refreshing the page.  Is this possible.

I hope I have not made this confusing for anyone.

Thank you,

AdonaiEchad

This topic has been closed for replies.

2 replies

November 4, 2010

I am going to refine my thinking here, it maybe a little bit of a repeat.

In my list.php page where I have links that goes to my details.php.

In my details.php page can it execute without refreshing, without hitting a submit button through a form or using AJAX?

Once I click on my list.php link that leads me to my details.php page as soon as that details.php page opens up in my browser, can there be a hidden form or some PHP code that can insert into a different table?  Some information from that different table that is being populated is from the details.php page and some is other stuff like I.P. address and timestamps.

I hope this simplifies what I am looking for.

November 4, 2010

Your refinement is a complete repeat of the discussion. It doesn't simplify what you're looking for because you've already been clearly described what you're looking for and you've been provided with a solution. As stated before: use the info passed from list.php to run a query on details.php. Here's an example:

list.php has links w/ URL parameters like so:

<a href="details.php?id=1">product 1</a>

<a href="details.php?id=2">product 2</a>

<a href="details.php?id=3">product 3</a>

<a href="details.php?id=4">product 4</a>

On details.php set a query to insert a record into the db based on the URL parameter and session variable of the logged in user:

INSERT INTO table_name (product_id, client, ip_address, date)
VALUES ($_GET['id'], $_SESSION['username'], $_SERVER['REMOTE_ADDR'], date("Y-m-d"))

Forget about the hidden form. Don't ever mention it again in this discussion thread. Use an INSERT MySQL query to insert dynamic values into your database table.

Participating Frequently
October 8, 2010

Use AJAX

October 8, 2010

I know this sounds stupid.  But how do I do that.  I am not familuar with AJAX.  Does DW4 have it in their Spry insert select?

October 9, 2010

As iPHP states that's what I want.

When the details.php page is showing, on that page can a hidden form populate a different table and processed behind the sceen without refreshing.

No no no dude. Do not put the form on details.php Put the form on list.php and, as suggested earlier with provided examples and explanation in post #5, use the link to submit the form.

So how does it work if my hidden form with no submit button populates the hidden form in the list.php once I click on my link 3 where it directs me to my details.php page?

What do you mean "how does it work"?... Put the php code to process the form data on details.php so when details.php is loaded from clicking on link that submits form in list.php the POST data from the form submission on list.php will insert the populated data into details.php before the page is loaded.

If the dynamic data in your form is from a recordset on details.php then no form is required anyway, simply run a query on details.php to insert the dynamic data from the recordset into another table. Seems redundant to populate so many fields if they're already in another table, IMO. All's you'd need is the primary key ID for link and user then add any additional data that isn't part of the original table.  (looks like browser type is all that's "really" being added into the new table)


Ok, so I looked at the examples that are out there such as below.

<a href="javascript:getsupport('Paid')">Paid Support</a>

I was able to use it, however, how do I incorporate the javascript to my dynamic link such as below?

<a href="details.php?link=<?php echo $row_rsUsers['linkid']; ?>">Show details for link 3</a>