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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:16:14+00:00 2026-06-12T04:16:14+00:00

I have a problem with $_GET . When I click the submit button it

  • 0

I have a problem with $_GET. When I click the submit button it doesn’t read the "id" which came from my first page of php. This is the link where the value of id came from <?php echo $content."<p><a href='post.php?id=$pid'>Comment.</a>"?></p> but when I try to to run this echo $_GET['id']; its working at it shows that it has value.

<?php
if (isset($_GET['id'])) {
$c = $_GET['id'];
}
mysql_connect("localhost","root","");
mysql_select_db("blog");
?>
<html>
<head>
<body background="u.jpg">
<center>

<a href="register.php"><img src="1.jpg" width="100" height="50"/></a>
<a href="login.php"><img src="2.jpg" width="100" height="50"/></a>
<a href="index.php"><img src="3.jpg" width="100" height="50"/></a>
</center>
<center>
<title>Pinoy Blog</title>
</head>
<?php
if(isset($_POST['submit']))
{
$content = $_POST['content'];

mysql_query("INSERT INTO comment (comment,p_id) VALUE('$content','$c')");
echo '<a href="index.php">span style="font-size:26px;"><strong><span style="font-family: verdana, geneva, sans-serif; ">Success! Tignan ang post.&nbsp;</span></strong></span>.</a> 
|| <a href="post.php">Magpost ulit? Click mo to.</a>';
}else{
?>
<form action='post.php' method='post'>
<span style="font-size:26px;"><strong><span style="font-family: verdana, geneva, sans-serif; ">Comment:&nbsp;</span></strong></span>
<textarea name='content' ></textarea><br />
<input type='submit' name='submit' value='POST!'/>
</form>
<?php
}
?>

<center>
</body>
</html>
  • 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-06-12T04:16:15+00:00Added an answer on June 12, 2026 at 4:16 am

    1) When you are coming from first page to second page with link then it’s called query string & you will get it in $_GET[‘id’]

    2) But now you are on second page & click on submit button it means it is new http request which doesn’t carry $_GET values from previous http request. so you need store $_GET[‘id’] into second page as hidden form field.

    Change your php code as below

    if (isset($_REQUEST['id'])) {
    $c = $_REQUEST['id'];
    }
    

    Now take one hidden field in your form.

    <form action='post.php' method='post'>
       <span style="font-size:26px;"><strong><span style="font-family: verdana, geneva, sans-serif; ">Comment:&nbsp;</span></strong></span>
       <input type="hidden" value="<?php echo $_REQUEST['id'] ?>" name="id">
      <textarea name='content' ></textarea><br />
       <input type='submit' name='submit' value='POST!'/>
    </form>
    

    Note: $_REQUEST default contains the contents of $_GET, $_POST and $_COOKIE

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

Sidebar

Related Questions

I have some problem to get the utf-8 string from PHP using jQuery $.load()
I have an Index.aspx page with a button. If you click the button a
Basically I have a follow button and when click the page refreshes and I
I have got a problem to get back a parameter from my view to
I have a problem with a webform. My Goal: Intially when a page is
I have a button on a page with an onClick I dynamically set via
In my application I have a Submit button that does this: private void Submit_button_Click(object
I have a remote_form which works 100% When a user clicks submit, it goes
I have a form with a submit button and it works fine, but I
I have jQuery go though all the submit buttons with the class button ,

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.