Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6530575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:46:20+00:00 2026-05-25T09:46:20+00:00

thanks now I have a error code HY093 Invalid parameter number after using the

  • 0

thanks now I have a error code HY093 Invalid parameter number after using the renameit SUBMIT button. Any idea why? thanks

Any help would be appreciated. Thanks a lot.

<?php 
// init
include("db_con1.php");
require("menu.php");

// modify distribution list name
if(is_numeric($_GET['gid'])) {
  $g_id=$_GET['gid'];
  $one = $pdo->prepare('SELECT * FROM contactgroups WHERE id=:gid');
  $one->bindParam(':gid', $g_id, PDO::PARAM_INT);
  if( $one->execute(array(':gid' => $_GET['gid'])) ) {
   $result = $one->fetch();
  }
}

// distribution list query
$queryl = $pdo->prepare('SELECT id, gr_name FROM contactgroups WHERE status=1 ORDER BY gr_name ASC');
$queryl->execute();

// Members list query
if (isset($_GET['gid'])) {
  $g_id=$_GET['gid'];
  $querym = $pdo->prepare('SELECT STRAIGHT_JOIN gm.linktype, if( gm.linktype = "group", cg.gr_name, cm.contact_sur ) mname FROM groupmembers gm LEFT JOIN contactgroups cg ON gm.link_id = cg.id LEFT JOIN contactmain cm ON gm.link_id = cm.id WHERE gm.group_id =:gid ORDER BY mname ASC');
  $querym->bindParam(':gid', $g_id, PDO::PARAM_INT);
  $querym->execute();
}

// distribution list query
$queryr = $pdo->prepare('SELECT * FROM contactmain WHERE status=1 ORDER BY contact_sur ASC');
$queryr->execute();

This is what should but does not work…

if (isset($_POST['renameit'])) {
    $ren = htmlspecialchars($_POST['rename']);
    $g_id = $_GET['gid'];

    if ($g_id !== '' && is_numeric($g_id)) { // Change that first to == if gid != 0 as well
        $sqlren = "UPDATE contactgroups SET gr_name = :rename WHERE id = :gid";
        $sqlren = $pdo->prepare($sqlren);

        $sqlren->bindValue(':rname', $ren); // <<< Is this supposed to be :ren?
        $sqlren->bindValue(':gid', $g_id);

        if ($sqlren->execute()) {
            echo  "<meta http-equiv=\"refresh\" content=\"0;URL=groups.php\">";
        } else {
            //Query failed.
            $errorcode = $sqlren->errorCode();
            echo $errorcode;
        }
    } else {
        echo 'gid not provided'; // Or something
    }
}
?>

and this is the HTML bit:

<form id="group-in" method="post" action="groups.php">
Add new Distribution group: <input type="text" name="newgroup" placeholder="name...">  <input type="submit" name="createit" value="Create new">
Rename groupname: <input type="text" name="rename" value="<?php echo $result['gr_name']; ?>"> <input type="submit" name="renameit" value="Rename">
</form>

<!-- Distribution list  -->
<div id="left"><label class="header">Distribution list</label>
<ul>

 <?php foreach ($queryl as $i => $rowl) { ?>

  <li >
   <?php if ($i)?>
   <input name="checkbox1_add[]" id="dist_<?php echo $i ?>" type="checkbox" value="<? echo $rowl['id']; ?>" />
   <label for="groups_<?php echo $i ?>">
   <a href="groups.php?gid=<?php echo $rowl['id']; ?>" <?php $g_id=$_GET['gid']; if ($g_id==$rowl['id']) echo 'class="bold"'; ?> >
    <?php echo $rowl['gr_name']; ?>
   </a></label>
 </li>
 <?php } ?>
</ul>
</div>

sorry for the long code but I think I loose this $_GET somehow after selecting the distribution item.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:46:21+00:00Added an answer on May 25, 2026 at 9:46 am

    Shouldn’t you be doing something like this?

    if (isset($_POST['renameit'])) {
        $ren = htmlspecialchars($_POST['rename']);
        $g_id = $_GET['gid'];
    
        if ($g_id !== '' && is_numeric($g_id)) { // Change that first to == if gid != 0 as well
            $sqlren = "UPDATE contactgroups SET gr_name = :ren WHERE id = :gid";
            $sqlren = $pdo->prepare($sqlren);
    
            $sqlren->bindValue(':rname', $ren); // <<< Is this supposed to be :ren?
            $sqlren->bindValue(':gid', $g_id);
    
            if ($sqlren->execute()) {
                echo  "<meta http-equiv=\"refresh\" content=\"0;URL=groups.php\">";
            } else {
                //Query failed.
                $errorcode = $sqlren->errorCode();
                echo $errorcode;
            }
        } else {
            echo 'gid not provided'; // Or something
        }
    }
    

    Also, if it’s always going to be an integer, you could use:

    $g_id = (int)$_GET['gid'];
    

    But you would need to be careful with things that evaluate to 0 and check for it in your if statement:

    if ($g_id > 0) {
    

    Assuming 0 is not a valid gid value.

    EDIT

    Looking at your markup and form, this all seems confused.

    For instance, your PHP code is using GET, but your code here is not including the gid in the ACTION attribute. (Also, you really should use two different forms for this, IMO.)

    <form id="group-in" method="post" action="groups.php?gid=<?php echo $g_id;?>">
     Add new Distribution group: 
     <input type="text" name="newgroup" placeholder="name...">
     <input type="submit" name="createit" value="Create new">
    </form>
    <form id="group-in" method="post" action="groups.php?gid=<?php echo $g_id;?>">
     Rename groupname: 
     <input type="text" name="rename" value="<?php echo $result['gr_name']; ?>">
     <input type="submit" name="renameit" value="Rename">
    </form>
    

    However, your comment seems to suggest that multiple checkboxes can be checked to rename a group? But then you don’t have a FORM tag around it:

    <!-- Distribution list  -->
    <div id="left"><label class="header">Distribution list</label>
    <form id="group-in" method="post" action="groups.php">
    <ul>
    
     <?php foreach ($queryl as $i => $rowl) { ?>
    
      <li >
       <?php if ($i)?>
       <input name="checkbox1_add[]" id="dist_<?php echo $i ?>" type="checkbox" value="<? echo $rowl['id']; ?>" />
       <label for="groups_<?php echo $i ?>">
       <a href="groups.php?gid=<?php echo $rowl['id']; ?>" <?php $g_id=$_GET['gid']; if ($g_id==$rowl['id']) echo 'class="bold"'; ?> >
        <?php echo $rowl['gr_name']; ?>
       </a></label>
     </li>
     <?php } ?>
    </ul>
    </form>
    </div>
    

    The challenge that you’re going to have here is that you need to loop through that $_POST['gid'] array, whereas the first single group rename you key off of the gid in the GET. I would suggest organizing your code into a Group/Groups object(s) and use a Model/View/Controller (MVC) pattern to organize your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I now have a working JavaScript autocomplete function, thanks to help from many of
I'm using SQLite3 in a Windows application. I have the source code (so-called SQLite
I have an error similar to the one in this post . Now, I'm
After having written a few helper classes in magento, now i have this problem,
Thanks for all your help, I now have add, update, and delete functions on
[I got it working now, it was just a browser error] My code is:
I now have it set up so that when people go to a thank
EDIT: I have fixed all but two warnings now, so thank you all for
Thanks for a solution in C , now I would like to achieve this
Now that I can make useful user controls in WPF (thanks to this stackoverflow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.