bullbreed Posted January 19, 2010 Share Posted January 19, 2010 HI 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; clientinfo.php?username=john 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; clientinfo.php?username=john But when the user clicks submit to send the new data the url changes to clientinfo.php 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; clientinfo.php?username=john 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; clientinfo.php?username=john And the data on the page refreshes itself. I think this might be really hard to do so asking for any help. Thanks Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 19, 2010 Share Posted January 19, 2010 do you have some code? Quote Link to comment Share on other sites More sharing options...
bullbreed Posted January 19, 2010 Author Share Posted January 19, 2010 Sorry, here it is <?php $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>"); }else{ echo "<td><font size=\"2\" color=\"#ff0000\">Please complete <b>ALL</b> fields</font><td>"; } } ?> <?php 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"> </form> </div> The URL currently reads clientinfo.php?username=john 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 Quote Link to comment Share on other sites More sharing options...
Lamez Posted January 19, 2010 Share Posted January 19, 2010 ya, like this echo '<form action="?username="'.$_GET['username'].'" />; Quote Link to comment Share on other sites More sharing options...
bullbreed Posted January 19, 2010 Author Share Posted January 19, 2010 I've tried it lots of ways and cant get it to work. I know i os probably me. Heres my code; <form action="clientinfo.php?username="'.$_GET['username'].'"" method="POST"> Is that right? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.