BallisticDK Posted March 13, 2012 Share Posted March 13, 2012 Hey, im trying to hide a form for a upload script. but it will just look like this (see picture). its for a school project, here is the code <div class="brick-left"> <?php $brugernavn = $_SESSION['brugernavn']; if ($_SESSION['brugernavn']) { $result = mysql_query("SELECT * FROM bruger WHERE brugernavn='$brugernavn'"); while ($row = mysql_fetch_array($result)) { $admin = $row['admin']; } if ($admin == 1){ echo"<center>"; echo"<form action=" . print $_SERVER["PHP_SELF"] . "method='post' enctype='multipart/form-data'>"; echo"<p><input type='hidden' name='contxt' value='upload'>"; echo"<input type='hidden' name='userId' value='123'>"; echo"<input type='file' name='upFile'></p>"; echo"<p><button type='submit'>Upload</button></p>"; echo"</form>"; } } ?> <?php print $message ?> </center> </div> Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/ Share on other sites More sharing options...
BallisticDK Posted March 13, 2012 Author Share Posted March 13, 2012 brugernavn = username on danish sry for that Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/#findComment-1326946 Share on other sites More sharing options...
ocpaul20 Posted March 14, 2012 Share Posted March 14, 2012 hiding a form is done in html not in php. Php generates the code for the page and the browser shows it. Of course, in php you can generate the html statements to cause the form to be hidden or not even on the page at all. do it with css ? hidden or display Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/#findComment-1327158 Share on other sites More sharing options...
BallisticDK Posted March 14, 2012 Author Share Posted March 14, 2012 hiding a form is done in html not in php. do it with css ? hidden or display Thanks how do i make it so it shows when a user is logged in then ? Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/#findComment-1327183 Share on other sites More sharing options...
trq Posted March 14, 2012 Share Posted March 14, 2012 Check if the user is logged in and if so display your form, otherwise don't. Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/#findComment-1327188 Share on other sites More sharing options...
BallisticDK Posted March 14, 2012 Author Share Posted March 14, 2012 Check if the user is logged in and if so display your form, otherwise don't. yeah i know but, witch code, or how do i do it ? Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/#findComment-1327195 Share on other sites More sharing options...
trq Posted March 14, 2012 Share Posted March 14, 2012 Assuming you have stored a 'logged in' flag in the $_SESSION array when your users log in, it would be something like.... if (isset($_SESSION['isLogged'])) { // show form } Quote Link to comment https://forums.phpfreaks.com/topic/258846-hiding-a-form-for-php-upload/#findComment-1327202 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.