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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:12:55+00:00 2026-05-24T22:12:55+00:00

I get values from an HTML form using a post method and store them

  • 0

I get values from an HTML form using a post method and store them in my DB through the mysql INSERT command (done in PHP).

something like this:

$value = $_POST['name'];
$value1 = $_POST['age'];
$sql = "INSERT INTO table(name,age) VALUES('$value','$value1')" ;

Now what I want to do is I want to give a link in the same PHP file like:

echo '<A HREF="http://xxx.com/rascal.php/">To update just entered info click on me</a>';

Now the rascal.php as mentioned in the link above also contains the same form fields (name and age).

The values stored in the database through the INSERT command above should be fetched from the DB and placed in the respective form field area (name and age should be stored in their respective forms of rascal.php).

How can I do this?

  • 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-24T22:12:57+00:00Added an answer on May 24, 2026 at 10:12 pm

    Here it is:

    <?php
    
    if(isset($_GET['name']) AND isset($_GET['age'])){
    $name=$_GET['name'];
    $age=$_GET['age'];
    }
    else{
    if(!empty($_POST['name']) AND !empty($_POST['age'])){
    
    $value=mysql_real_escape_string($_POST['name']);
    $value1=mysql_real_escape_string($_POST['age']);
    $sql = "INSERT INTO table(name,age) VALUES('$value','$value1')" ;
    mysql_query($sql);
    
    echo '<A HREF="http://xxx.com/rascal.php?name='.$value.'&age='.$age.'">To update just entered info click on me</A>';
    }
    }
    
    ?>
    
    <form method="POST">
    <input name="name" value="<?php print $name;?>"/>
    <input name="age" value="<?php print $age;?>"/>
    </form>
    

    This should work if you change ‘table’ to your table name. You should be happy, because I wrote the entire code for you. Please show it.

    Further advice: Make sure your code is save by passing all input variables through a mysql_real_escape_string() function. Add an id field (unique key, self incrament) to your database table so you can select records based on their id’s and not some other field (The code I provided only works if you don’t have more entries with the same name).

    There are some great php tutorials here.

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

Sidebar

Related Questions

HTML <form action='insert.php' method='POST'> <p><b>Client:</b><input type='text' name='idclient'/> <p><b>Total:</b><br /><input type='text' name='total'/> <p><input type='submit' value='Save'
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
Is there a better way than using globals to get interesting values from a
ok now i am using the SQL database to get the values from different
Is there a way to get all possible values from a MySQL enum column?
I use jQuery to get values of presaved elements from some websites, using paths
I have a form which submits user first and last name using POST signin.html
I have a via with some jQuery function to get value from HTML element
I'm trying to get the values from a pointer to a float array, but
I'm spinning my wheels on this. How do I get the values from 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.