dean7 Posted August 1, 2009 Share Posted August 1, 2009 Hi all, on my website i have got a profile for every user but got a problem for submiting the data: <?php include('style.css'); ?> <? ob_start(); include("config.php"); if ($logged[username]) { // the user is logged in! We continue... if (!$_POST[update]) { // the form hasn't been submitted. We continue... $profile = mysql_query("SELECT * from users where username = '$logged[username]'"); $profile = mysql_fetch_array($profile); // the above lines get the information so that it can be displayed in the html form. echo(" <form action=\'POST\'> <center> Your Msn<input size=\'25\' name='msn' value='$profile[msn]'><br /> Aol<input size=\'25\' name='aim' value='$profile[aim]'><br /> Email Address<input size=\'25\' name='email' value='$profile[email]'><br /> Profile Content<input size=\"50\' name='content' value='$profile[content]'><br />; <input type='submit' value='Update'/> </center> </form>"); } else { $email = htmlspecialchars($_POST[email]); $aim = htmlspecialchars($_POST[aim]); $msn = htmlspecialchars($_POST[msn]); $locate = htmlspecialchars($_POST[locate]); $content = htmlspecialchars($_POST[content]); // the above lines get rid of all html. echo ("Your profile has been updated!"); $update = mysql_query("Update users set email = '$email', msn = '$msn', aim = '$aim', location = '$locate' where username = '$logged[username]'"); // updates the information in the database. } } else { // They aren't logged in! echo ("<a href=\"index.php\">You must login</a>"); } ?> When the write data in the fildes it dont show up an submit button.. but when im not echoing it it show a submit button. Anyone know a way i make it show while its still echoing? Thanks. Link to comment https://forums.phpfreaks.com/topic/168375-profile-problem/ Share on other sites More sharing options...
bundyxc Posted August 1, 2009 Share Posted August 1, 2009 I think that you need to better explain yourself. Slow down, think about what you're typing, and let us know exactly what's going on. Link to comment https://forums.phpfreaks.com/topic/168375-profile-problem/#findComment-888190 Share on other sites More sharing options...
dean7 Posted August 1, 2009 Author Share Posted August 1, 2009 Allright.. My website has an profile system and when a user try's to edit there profile there isnt a submit button so they can, but when it isnt in the 'echo' tags the submit button shows. But im needing help on getting the submit button to show while its in the echo. Link to comment https://forums.phpfreaks.com/topic/168375-profile-problem/#findComment-888193 Share on other sites More sharing options...
bundyxc Posted August 1, 2009 Share Posted August 1, 2009 It sounds like you're trying to tell me that the submit button isn't being echoed when it should.. whereas when it isn't supposed to, then it is being echoed? So pretty much: <?php if (echo == 'on') { // Do nothing. } elseif (echo == 'off') { echo 'Submit Button.'; } ?> Is that about right? Sorry, I'm just confused and trying to figure out exactly what your problem is. Link to comment https://forums.phpfreaks.com/topic/168375-profile-problem/#findComment-888209 Share on other sites More sharing options...
dean7 Posted August 1, 2009 Author Share Posted August 1, 2009 It sounds like you're trying to tell me that the submit button isn't being echoed when it should.. whereas when it isn't supposed to, then it is being echoed? So pretty much: <?php if (echo == 'on') { // Do nothing. } elseif (echo == 'off') { echo 'Submit Button.'; } ?> Is that about right? Sorry, I'm just confused and trying to figure out exactly what your problem is. Quite hard to explane well basicly i have a form echoed on my script with the email profile content etc boxes but users can wright in them but they carnt submit the data they have wrote because there isnt a submit button. On the script there is the submit button but it just isnt showing it. Link to comment https://forums.phpfreaks.com/topic/168375-profile-problem/#findComment-888214 Share on other sites More sharing options...
bundyxc Posted August 1, 2009 Share Posted August 1, 2009 Try using this code instead: <?php include('style.css'); ob_start(); include("config.php"); if ($logged['username']) { if (!$_POST['update']) { // the form hasn't been submitted. We continue... $profile = mysql_query("SELECT * from users where username = '$logged[username]'"); $profile = mysql_fetch_array($profile); // the above lines get the information so that it can be displayed in the html form. echo(" <form action=\'POST\'> <center> Your Msn<input size=\'25\' name='msn' value='$profile[msn]'><br /> Aol<input size=\'25\' name='aim' value='$profile[aim]'><br /> Email Address<input size=\'25\' name='email' value='$profile[email]'><br /> Profile Content<input size=\"50\' name='content' value='$profile[content]'><br /> <input type='submit' value='Update'/> </center> </form> "); } else { $email = htmlspecialchars($_POST[email]); $aim = htmlspecialchars($_POST[aim]); $msn = htmlspecialchars($_POST[msn]); $locate = htmlspecialchars($_POST[locate]); $content = htmlspecialchars($_POST[content]); echo ("Your profile has been updated!"); $update = mysql_query('UPDATE users SET email = \'' . $email . '\', msn = \'' . $msn . '\', aim = '$aim . '\', location = \'' . $locate . '\' where username = \'' . $logged[username] . '\''); } } else { echo ("<a href=\"index.php\">You must login</a>"); } ?> Link to comment https://forums.phpfreaks.com/topic/168375-profile-problem/#findComment-888216 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.