wmguk Posted April 22, 2010 Share Posted April 22, 2010 Hi, I'm trying to pass a database variable to a function... <?php global $__CMS_CONN__; $sql = "SELECT * FROM " . TABLE_PREFIX . "products"; $stmt = $__CMS_CONN__->prepare($sql); $stmt->execute(array($id)); while ($row = $stmt->fetchObject()) { $pid = $row->pid; $pname = $row->pname; $pdesc = $row->pdesc; $pprice = $row->pprice; ?> <a href="<?php echo get_url('plugin/ecat/edit'.$pid); ?>"><img src="<?php echo ECAT_ROOT;?>images/product_edit.jpg" align="middle" alt="Edit Product" /></a> However it goes to /plugin/ecat/edit1 or edit2 etc etc. - I'm trying to get it to go to edit and pass $pid to a function function edit($id) { $this->display('ecat/views/edit'); } any ideas? Quote Link to comment Share on other sites More sharing options...
trq Posted April 22, 2010 Share Posted April 22, 2010 Your going to need to be allot clearer than that I'm afraid. Quote Link to comment Share on other sites More sharing options...
wmguk Posted April 22, 2010 Author Share Posted April 22, 2010 ok, I am using a CMS system called WolfCMS, and I am trying to make a plugin for it. Basically I have a section of files, some with functions in, and others using those functions... My ultimate goal is to edit a product. - Name, Desc, Price (ID is fixed).... So, I click on <a href="<?php echo get_url('plugin/ecat/edit'.$pid); ?> and it checks my function list for edit() function edit($id) { $this->display('ecat/views/edit'); } so how do i get it to assign $id to the $pid in the url? once the id is assigned, it will edit the code using <h1><?php echo __('Edit Product'); ?></h1> <form action="<?php echo get_url('plugin/ecat/edit_prod' . $product->id); ?>" method="post"> <input name="pid" type="hidden" value="<?php echo $pid; ?>"/> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="200">Product Name:</td> <td><input name="pname" type="text" value="<?php echo $pname; ?>"/></td> </tr> <tr> <td>Product Description</td> <td><input name="pdesc" type="text" value="<?php echo $pdesc; ?>"/></td> </tr> <tr> <td>Product Price:</td> <td><input name="pprice" type="text" value="<?php echo $pprice; ?>"/></td> </tr> <tr> <td> </td> <td><input class="button" name="commit" type="submit" accesskey="s" value="<?php echo __('Save'); ?>" /></td> </tr> </table> </form>[code] Quote Link to comment Share on other sites More sharing options...
wmguk Posted April 22, 2010 Author Share Posted April 22, 2010 has that made anything clearer? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.