Jump to content

Submit data and refresh the page


Recommended Posts



I have a page on my website called clientinfo.php.

This page echos data from the database about a particular client so the url shows;




at the bottom of the page is a form that submits some information in to the database

This information is echoed to the same page as it was submitted from;



But when the user clicks submit to send the new data the url changes to




So the url in the client page containing johns information changes.


The user who submitted the info has to click the back button to return to the client page;



And click refresh to see the new data added to the page


How can I make it so when the user clicks the submit button the page remains at;



And the data on the page refreshes itself.


I think this might be really hard to do so asking for any help.



Link to comment
Share on other sites

Sorry, here it is

$submit = $_POST['submit'];

//Form data
$action = addslashes(strip_tags($_POST['action']));
$username = addslashes(strip_tags($_POST['username']));
$client = addslashes(strip_tags($_POST['client']));
$date = date("Y-m-d");

if ($submit){

//Check for existing fields
if ($action && $username){
	//Register the user
	$queryreg = mysql_query("INSERT INTO " . TBL_ACTION . " 
  (`action`, `username`, `teammember`, `date`) 
  VALUES ('$action', '$client', '$username', '$date')");
	echo("<td><font size=\"2\" color=\"#0066FF\">The action has been udated! </font><td>");
	echo "<td><font size=\"2\" color=\"#ff0000\">Please complete <b>ALL</b> fields</font><td>";


if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";

<form action="clientinfo.php" method="POST">
    	<p class="textinput">Action taken: </p><p><textarea name="action" cols="50" rows="5" value="<?php echo $form->value("action"); ?>"></textarea><?php echo $form->error("action"); ?></p>
        <p><input type="hidden" name="client" maxlength="30" readonly value="<?php echo $_GET['username']; ?>"><?php echo $form->error("user"); ?></p>
        <p><input type="hidden" name="username" maxlength="30" readonly value="<?php echo $_SESSION['username']; ?>"><?php echo $form->error("user"); ?></p>
        <input type="submit" name="submit" value="Submit">


The URL currently reads



Can the <form action="clientinfo.php" method="POST">


Be something like


<form action="clientinfo.php?username=current url username" method="POST">


Because I could be reading one of many different clients information so the url could contain a different users name if im viewing someting else

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.