shabbaranks Posted May 28, 2012 Share Posted May 28, 2012 Hi all, Im currently modifying some example code for a form which a user submits. Initially the form asked the user to input thier username but I have managed to get it so that the username is populated from the current user login. What I am struggling to do is understand how the $post works. Am I correct in thinking that <tr> <td> Name</td> <td input name="contactname" id="contactname" class"secondary-bfe-inputs" value=>'$current_user->display_name.'</td> </tr> is holding the value of $current_user->display_name. and where I use '.$_POST['contactname'].' will show the value? If not could you explain what I should be doing please? Thanks Link to comment https://forums.phpfreaks.com/topic/263264-php-post-coding-could-someone-explain-what-im-doing-wrong-please/ Share on other sites More sharing options...
Barand Posted May 28, 2012 Share Posted May 28, 2012 you can't put the input inside a <td> tag value=> should be value= <td> <input type='text' name="contactname" id="contactname" class="secondary-bfe-inputs" value='<?php echo $current_user->display_name?>' /></td> edit: added type attribute Link to comment https://forums.phpfreaks.com/topic/263264-php-post-coding-could-someone-explain-what-im-doing-wrong-please/#findComment-1349189 Share on other sites More sharing options...
shabbaranks Posted May 29, 2012 Author Share Posted May 29, 2012 Ah ok - Im not too sure whats going on here but I had it working. Re started the server and now its not displaying again the code I now have is <td>Name</td> <td> <input type="text" input name="contactname" disabled="true" id="contactname" class="secondary-bfe-inputs" value='.$current_user->display_name.' /></td> if I change the type="text" to type='text' the page doesnt work. Also my <?php tags are at the start and the end of the page hence why they arent in the above code. Thanks Link to comment https://forums.phpfreaks.com/topic/263264-php-post-coding-could-someone-explain-what-im-doing-wrong-please/#findComment-1349464 Share on other sites More sharing options...
shabbaranks Posted May 29, 2012 Author Share Posted May 29, 2012 Fixed - I think I had the comma's and the quotes incorrectly placed. Link to comment https://forums.phpfreaks.com/topic/263264-php-post-coding-could-someone-explain-what-im-doing-wrong-please/#findComment-1349508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.