myselfamit47 Posted August 15, 2017 Share Posted August 15, 2017 (edited) <form method="post" action=""> <input type="text" name="username"> <input type="button" name="sbutton" value="click button "> <?php if(isset($_POST['sbutton'])) { $value=$_POST['username']; echo "$value"; } ?> </form> i want to print the value of textbox on that same page ..but it is not working.. plz help me... i have done this also <?php $value=$_POST['username']; echo "$value"; ?> and this also <?php $value=$_GET['username']; echo "$value"; ?> but it is not working..........plz help me Edited August 15, 2017 by cyberRobot added [code][/code] tags Quote Link to comment Share on other sites More sharing options...
Barand Posted August 15, 2017 Share Posted August 15, 2017 Instead of type="button" use type="submit" so that your form is submitted. 1 Quote Link to comment Share on other sites More sharing options...
myselfamit47 Posted August 15, 2017 Author Share Posted August 15, 2017 thank u ... In visual studio ,,when we create .net projects we have a feature of debugging the code, in which we execute the code line by line and can check for errors,,like this in php have we debugging feature?? if yes then in which IDE.?? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 15, 2017 Share Posted August 15, 2017 I use Nusphere's PHPEd IDE, It has an excellent debugging facility, But any decent IDE should provide one, Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 15, 2017 Share Posted August 15, 2017 Try putting all your html together and don't put php in the middle. Plus if you want the value to show up actually IN the text field use a value attribute on that tag. Basic HTML stuff. Quote Link to comment Share on other sites More sharing options...
myselfamit47 Posted August 19, 2017 Author Share Posted August 19, 2017 i have written this code for uploading a file ... <form method="post" action="" enctype="multipart/form-data"><input type="file" name="upload"><input type="submit" name="fileupload" value="upload the file"></form><?php$target_dir = "uploads/";$target_file = $target_dir . basename($_FILES['upload']['name']);$uploadOk = 1;$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);// Check if image file is a actual image or fake imageif(isset($_POST['submit'])) { $check = getimagesize($_FILES['upload']['tmp_name']); if($check !== false) { echo "File is an image - " . $check['mime'] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; }}?> but it is not working.....plz help me.... Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 19, 2017 Share Posted August 19, 2017 Why checking for submit button names is a bad idea. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted August 19, 2017 Share Posted August 19, 2017 Your code is looking for something named "submit" in your $_POST array. There isn't anything with that name. Look at your code again. 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.