thefollower Posted September 9, 2007 Share Posted September 9, 2007 I have a form where by you input a number and then it inserts that number to the table but it just wont insert ! I have a seperate process page which recieves the input using _POST Heres the code: <form name="" method="POST" action="choosehousenumberprocess.php" enctype="text/plain" id="Form1"> <input type="submit" id="Button1" name="Button1" value="Submit" style="position:absolute;left:182px;top:187px;width:75px;height:24px;z-index:0"> <input type="text" id="Editbox1" style="position:absolute;left:148px;top:149px;width:144px;font-family:Courier;font-size:19px;z-index:1" size="16" name="HouseNumber" value=""> </form> choosehousenumberprocess.php $HouseNumber = $_POST['HouseNumber']; Echo $HouseNumber; $InsertNumber = "UPDATE houses SET HouseNumber = '$HouseNumber' WHERE UserID='{$_SESSION['Current_User']}'"; mysql_query($InsertNumber) or die(mysql_error()); The echo also produces nothing in return =/ Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/ Share on other sites More sharing options...
marcus Posted September 9, 2007 Share Posted September 9, 2007 Try putting the text field before the submit field. Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344926 Share on other sites More sharing options...
teng84 Posted September 9, 2007 Share Posted September 9, 2007 is there any error ? Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344939 Share on other sites More sharing options...
thefollower Posted September 9, 2007 Author Share Posted September 9, 2007 No, no error. Just blankness... its basically inputted null which defaults to 0 in the table. When i echo the variable as shown in the above post its just nothing. I swapped them around in the form but no change im afraid. Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344941 Share on other sites More sharing options...
teng84 Posted September 9, 2007 Share Posted September 9, 2007 try this first <html> <body> <?php $HouseNumber = $_POST['HouseNumber']; echo $HouseNumber; $InsertNumber = "UPDATE houses SET HouseNumber = '$HouseNumber' WHERE UserID='{$_SESSION['Current_User']}'"; mysql_query($InsertNumber) or die(mysql_error()); ?> <form name="" method="POST" action="<? $_SERVER['PHP_SELF']?>" id="Form1"> <input type="text" id="Editbox1" style="position:absolute;left:148px;top:149px;width:144px;font-family:Courier;font-size:19px;z-index:1" size="16" name="HouseNumber" value=""> <input type="submit" id="Button1" name="Button1" value="Submit" style="position:absolute;left:182px;top:187px;width:75px;height:24px;z-index:0"> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344957 Share on other sites More sharing options...
thefollower Posted September 9, 2007 Author Share Posted September 9, 2007 ok i inputted 23 and the result was it echo'd 23 so that worked. but thats in the same script Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344962 Share on other sites More sharing options...
teng84 Posted September 9, 2007 Share Posted September 9, 2007 i do that to know where you went wrong hmm are this file youre accessing in the same folder? Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344964 Share on other sites More sharing options...
thefollower Posted September 9, 2007 Author Share Posted September 9, 2007 yeh Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344975 Share on other sites More sharing options...
teng84 Posted September 9, 2007 Share Posted September 9, 2007 if my sample work then all you have to do is to break it and put the correct page where you want that action my sample is not different with yours so just try to explode those in your desired page then it will surely work Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-344993 Share on other sites More sharing options...
tippy_102 Posted September 9, 2007 Share Posted September 9, 2007 If it echos the correct number, but won't insert it, then my guess is that this part if wrong: UserID='{$_SESSION['Current_User'] Add an echo $_SESSION['Current_User' and see if it is what you expect. Link to comment https://forums.phpfreaks.com/topic/68628-solved-form-problem/#findComment-345005 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.