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

  • SEARCH
  • Home
  • 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 6645405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:17:00+00:00 2026-05-26T00:17:00+00:00

The issue I am having is that my form submit button, because it is

  • 0

The issue I am having is that my form submit button, because it is within the foreach loop, ends up submitting for every single item that the foreach runs through. If I put it on the outside of the loop the submit does not have the correct number to submit, it ends up submitting the last value in the foreach. Does anyone have a solution for this?

    <div data-role='collapsible' data-collapsed='true' data-icon='arrow-l'>
        <h3><?=$ticket['ticket_no']?> - <?=$ticket['title']?></h3>

        <div class="ui-body ui-body-a"> 
            <ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="c">
            <li data-role="list-divider"><h1></h1></li> 
            <li><h3>Description</h3><br><br><?=$ticket['description'] ?></li>
            <input type=hidden name=ticket_number value=<?= $ticket['ticket_no'];  ?>>
            <form action="<?=$_SERVER['PHP_SELF']; ?>" method="post">
            <fieldset>
                <div data-role="fieldcontain">
                    <label for="status" class="select">Change Status:</label>
                    <select name="status" id="<?=$ticket['ticket_no']?>">
                        <option value="Open">Status</option>
                        <option value="Tracker">Tracker</option>
                        <option value="Abandon">Abandon</option>
                        <option value="Communicate">Communicate</option>
                        <option value="Closed">Closed</option>
                    </select>
                </div>
                <input type="submit" data-theme="a" name="submit" value="Submit"></input>
            </fieldset>
        </form>


        </div><!-- /themed container --> 
    </div> <!-- End inner collapsible set -->

}
?>

  • 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-26T00:17:00+00:00Added an answer on May 26, 2026 at 12:17 am

    In each form, put something like:

    <input type=hidden name=ticket_number value=<?= $ticket['ticket_no'];  ?>>
    

    and then move your if() to outside of the loop, and check for $_POST[‘ticket_number’]

    if(isset($_POST['submit']) && isset($_POST['ticket_number'])) {
     $tickNum = $_POST['ticket_number'];
     updateTT($tickNum);                            
    } 
    

    This was done with the least amount of change possible. Please sanitize your input, and all that good stuff!

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

Sidebar

Related Questions

I'm having an issue in IE7 and below where a form that I'm toggling
I have created a contact form that has a disabled submit button until all
I'm having an issue with a form that I have. The form allows users
I'm having issues submitting the result of a form submission (I can submit a
I am having an issue that I can't seem to figure out. Hopefully somebody
Hey, I'm having an issue that appears to be related to collation, but I'm
Having an issue here that I have tried everything I can think of but
I'm having an issue with a query that currently uses LEFT JOIN weblog_data AS
I'm having an issue with a trigger that inserts a value into the same
I'm having an issue with a standard ASP.NET page that has a TextBox and

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.