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 8, 2010

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

Ajax is not necessary. You click a link to visit the detail page. Make the link submit the form with hidden fields. Problem solved!