Link to home
Start Free TrialLog in
Avatar of kbios
kbios

asked on

How do I get a PHP to run from HTML?

I have an HTML menu where the menu items are an unnumbered list. Here is one of the list items:

<li><a href="verifycart.php?ukey=12345">Verify Cart</a></li>

When I select this option from the menu the verifycart.php code executes. BUT, the variable is NOT passed. Question 1 - How do I pass data/variable to the PHP from here?
Here is the .php code:

<?php
    error_reporting(E_ALL);
    include ("config.inc.php");
    $ukey = htmlspecialchars(trim($_POST['ukey']));
    $ukey="12345";
                        
    $conn = mysql_connect("localhost", "X", "Y.") or die('Verify DB Failure ' . mysql_error());
    mysql_select_db("test");
                  
    $result = mysql_query("SELECT * FROM itemhdr WHERE itemhdr.ukey = '$ukey'");
               
           if (!$result) {
               die('QUERY ERROR: verifyupload ' . mysql_error());
           }
                        
          $row = mysql_fetch_assoc($result);
          $vcount = $row['verifycount'];
                  
echo "INSIDE PHP " .$ukey;
echo "|";                                             
echo "VCOUNT " .$vcount;                        
                              
    mysql_close($conn);
                        
?>

Question 2 - Why doesn't $ukey get set via the POST?

Thanks in advance for your help.
ASKER CERTIFIED SOLUTION
Avatar of amigura
amigura
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kbios
kbios

ASKER

Thanks to both of you. The $_GET did the trick.
Avatar of kbios

ASKER

Thanks.

I have a followup question that I will be posting in a minute.