Cruzer Posted May 21, 2007 Share Posted May 21, 2007 Hello, This is my first time here and I'm a real newbie at PHP. I've written a number of pages where I've submitted forms, then use the $_POST to load this data into variables on the new page that I've called. This works fine. However, now I am reading a MySQL database and displaying the records in an HTML table. But, instead of creating a form with a submit button, I would like to click on a hyperlink to post that data to the next webpage. The table consists of 4 columns - an image, a unique ID nbr, a description, and a selling price. (It's sort of a classifieds ad style page). I would like to use a mouseclick to select the graphic and/or one of the text columns to post the ID nbr to the next page so that I can display that item's details. I'm thinking I might have to use Javascript to do this but my fiddling with the onclick statement doesn't seem to do anything. Probably because I know even less about javascript than PHP. Link to comment https://forums.phpfreaks.com/topic/52363-solved-submitting-a-form-without-a-submit-button/ Share on other sites More sharing options...
AndyB Posted May 21, 2007 Share Posted May 21, 2007 For each item, add a simple html link like href='show-more.php?id=ID# and then show-more.php retrieves the passed id from the $_GET array. <?php // show-more.php $ID = $_GET['id']; // passed by url .. use ID to retrieve item data from database ... Link to comment https://forums.phpfreaks.com/topic/52363-solved-submitting-a-form-without-a-submit-button/#findComment-258507 Share on other sites More sharing options...
Cruzer Posted May 21, 2007 Author Share Posted May 21, 2007 I originally tried that. I used an <href> statement to link to the new page but I did it sort of like "href=newpage.php?<?php echo $adnbr ?> but the URL just added the number of the ad after the base URL and I couldn't get the $_GET to retrieve the data to a PHP variable. When I try it your way, and add the "ID=" to the adnbr, the $_GET function works and I can retrieve the data and put it into aPHP variable. Thanks, that solved it. I told you I was new at this. Link to comment https://forums.phpfreaks.com/topic/52363-solved-submitting-a-form-without-a-submit-button/#findComment-258521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.