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 6944371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:17:54+00:00 2026-05-27T13:17:54+00:00

i have 2 programs welcome.php and form.jsp. i am tyring to insert values into

  • 0

i have 2 programs welcome.php and form.jsp. i am tyring to insert values into SQL database using odbc through user form. i have created a userform using form.jsp. inserting rows using welcome.php. while insertion am not inserting duplicate values so that am checking conditions in while loop. when the if statements are working, it’s completely come out from the program due to exit() statement. after execution of exit am getting blank page. but i need to stayback to the user form or the control should go to form.jsp so that again i should get the user form to enter the details without giving blank page.how can i do this?

        $query1="select * from company";
        $result1 = odbc_exec($connect, $query1);

         while(odbc_fetch_row($result1)){
         $compname[$index] = odbc_result($result1, 1);
         $empname[$index] = odbc_result($result1, 2);

        if($compname[$index]==$_POST['cname'])
        {
       echo "<script> alert(\"compname Exists\") </script>";
       exit();
       //exit("<script> alert(\"compname Exists\") </script>");
       }
       if($empname[$index]==$_POST['ename'])
       {
      echo "<script> alert(\"empname Exists\") </script>";
      exit();
     }
     }
     $query=("INSERT INTO dbo.urllink(cname,ename) VALUES ('$_POST[cname]','$_POST[ename]') ");
     $result = odbc_exec($connect, $query);
    echo "<script> alert(\"Row Inserted\") </script>";

 ?>
  • 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-27T13:17:55+00:00Added an answer on May 27, 2026 at 1:17 pm

    Using exit() stops the processing of the program. To send the user to another page from PHP, you can use the header() function, with the ‘Location: ‘ parameter:

    header('Location: form.jsp');
    

    Note that you cannot output information (using echo for example) and then use the header function. All output will need to be done by the page your sending them to.

    If you want to pass information, like a submitted field exists, you can send it using a query string parameter, for example:

    header('Location: form.jsp?error=abc');
    

    Your JSP page would then display an error depending on what abc meant.

    Alternatively, you can use sessions to pass more complex information to another page.
    You can find more info on sessions here.

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

Sidebar

Related Questions

I have two begininer programs, both using the 'while' function, one works correctly, and
I have several somewhat separate programs, that conceptually can fit into a single project.
I have an MySQL database which contains some data,it interacts with JSP pages,the thing
Many programs have created a huge amount of swap files. They annoy me, because
I have two programs, Writer and Reader. I have a FIFO from Writer to
I have two programs: one CLI program, and one GUI. The GUI is a
I have two (UNIX) programs A and B that read and write from stdin/stdout.
I have seen many programs consisting of structures like the one below typedef struct
We have some COBOL programs in our financial applications which need to interact with
I would like a batch file to launch two separate programs then have the

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.