Pavlos1316 Posted July 22, 2008 Share Posted July 22, 2008 Hi This is my code for checkboxes to stay checked if submition fails: $check = array(); if(isset($_POST['home1'])) $check[] = $_POST['home1']; $all = count($check); $at = ($all == 0) ? 1 : 0; <input type="checkbox" name="home1" id="home1" value="home1" <?php if($at <= $all && $check[$at] == home1) {echo 'checked'; $at++;}?>/ How do I modify this so if registration fails for any reason the data that user already insert not to disappear? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/ Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 echo you data in the input value. like: <input type='text' value='<?php echo $name;?>'> Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596291 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 You mean without the rest of the code? Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596314 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 rest of the code???? Not sure what you mean by this. $name is coming from your submit button. Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596318 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 I ment the code that I was using for checkboxes... I see now what YOU ment It works Thank you Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596325 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 Ah small promblem... The code I entered for value is now displayed in my register fields... How do I hide it or what is the mistake? Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596331 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 can you show the code for that field. Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596334 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" value="<?php echo $Full_Name;?>"/> Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596335 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 try this: <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" value='<?php echo $Full_Name;?>'> Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596338 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 I already did. first time worked... then I always get displayed the value at my fields Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596341 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 Did you try my above post. Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596343 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 Yes I did... Is the same code for value that you gave me at your first answer. In the mean time... value isn't suppose to display in fields what ever you there? Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596348 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 try to put again the URL in the browser and go to that page. because the value is still in the variable. Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596352 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 Did it... Also cleaned cookies and cache... Nothing happens.. :-\ Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596353 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 Can you post your complete code. Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596357 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 <th scope="col"><form action="register.php" method="post" enctype="application/x-www-form-urlencoded" name="register" id="register"> <div align="center"> <div align="left"> <pre><span class="style71"> Full Name:</span> <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" value='<?php echo $Full_Name;?>'><span class="style71"> Birthday: </span><input name="Birthday" type="text" id="Birthday" size="12" maxlength="10" /> <span class="style75"> accounts</span> <span class="style69"> (dd-mm-yyyy)</span> <span class="style71">Mail:</span> <input name="Mail" type="text" size="89" maxlength="77" id="Mail" /> <span class="style75"> with false statements</span> <span class="style69"> (Street-Street No-Territory-Postal Code-Town-Country)</span> <span class="style71">E-mail:</span> <input name="E_Mail" type="text" size="30" maxlength="30" id="E_Mail" /> <span class="style71">Phone No:</span> <input name="Phone_No" type="text" id="Phone_No" size="25" maxlength="19" /> <span class="style75">will be deleted</span></pre> <pre> <span class="style71">Username: </span><input name="Username" type="text" size="30" maxlength="10" id="Username" /> <span class="style71">Password:</span> <input name="Password" type="password" size="25" maxlength="10" id="Password" /> <span class="style75"> automatically!!!</span></pre> </div> </div> <div align="left"> <pre><span class="style75"> By submitting this form you agree to accept all <a href="terms and conditions.html" target="_new">Terms and Conditions</a></span> <input name="Submit" type="submit" id="button" onclick="this.form.post" value="Submit" /></pre> </div> </form></th> Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596366 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 it worked like that <input name=bla <?php if (isset($_POST['Full_Name'])) { echo 'value="'.$_POST['Full_Name'].'"'; } ?>/> Thanks Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596405 Share on other sites More sharing options...
Pavlos1316 Posted July 22, 2008 Author Share Posted July 22, 2008 something else came up <input name="Full_Name" type="text" id="Full_Name" size="50" maxlength="19" <?php if (isset($_POST['Full_Name'])) { echo 'value="'.$_POST['Full_Name'].'"'; } ?>/> This is working fine just in my register page i see the /> after my textfield. Any ideas what to fix? Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-596418 Share on other sites More sharing options...
Pavlos1316 Posted July 23, 2008 Author Share Posted July 23, 2008 someone? Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-597188 Share on other sites More sharing options...
Pavlos1316 Posted July 23, 2008 Author Share Posted July 23, 2008 THIS THREAD WAS SOLVED IN REPLY No 16. IGNORE REPLIES No 17 & 18 CAUSE WHENEVER i ASK SOMETHING ELSE IN A TREAD NEVER GET SOLVED THANKS Quote Link to comment https://forums.phpfreaks.com/topic/115978-solved-dont-loose-insert-data-upon-submition-fail/#findComment-597444 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.