ok i tried it and it will not display the user name at al i dont get whats going on so for 1 last attempt lol im going to fully expalin whats going on
ok above if($_POST['submit']) i can grab the name via $_GET['username'] but anything below then i cannot echo it...how comes??
PHP Code:
get username gets the name of the profile form the url due to this
PHP Code:
RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1
PHP Code:
<?php session_start(); ?> <?php $user = isset($_GET['username'])? $_GET['username'] : ""; //echo $user; this displays the user name but anything below it does not if($_POST['submit']) { // Verify if the fields were filled. if(!$_POST['message']) { echo 'Error, You need to post a Message!'; die; } // Date format $date = date("d/m/y"); // http://www.php.net/date // Assign variables of the forms // Connect to the database include('../settings.php'); $user1 = $_POST['usersaccount']; $id = $_SESSION['user_id']; $username = get_username($id); $message = $_POST['message']; $ip = $_SERVER['REMOTE_ADDR']; // Insert the info in the shoutbox table. $query = "INSERT INTO shoutbox (`user`, username, message, date, ip) VALUES ('$user1','$username','$message','$date','$ip')"; mysql_query($query); // close connection // Show message to let them return to the shoutbox ?> <div align="center">Thank you for submitting.<br> Return to the <a href="shoutbox.php">shoutbox</a>! <?php // If NOT submitted } else { $query = "SELECT * FROM shoutbox ORDER BY id DESC LIMIT 3"; $result = mysql_query($query); // Create a table ?> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <? // Run a While loop for the rows while($c = mysql_fetch_array($result)) { ?> <tr> <td> <? echo $c[username] ?> says: <div align="justify"><? echo $c[message] ?></div> </td> </tr> <tr><td>on <? echo $c[date] ?> <hr noshade="noshade" size="1" style="border-style: dashed" color="#000000" /></td></tr> <? } ?> </table> <form method="post" action="box.php"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td>Message :</td> <td><input type="text" name="message" class="forms"><input type="hidden" id="usersaccount" name="usersaccount" value="<?php $user ;?>" /></td> </tr> <tr> <td colspan="2"><input type="submit" name="submit" value="Speak!" class="subtmit"></td> </tr> </table> </form> <?php } ?> </body> </html>
is it because i need to do somethingwith action="box.php" .... this page is actually box.php itself so allits really doing is sending it back to this page....
the page i have included this script on has the name in the url... if i went to just mywebsite.com/box.php it would look like that so i included it on http://www.mywebsite.com/username i thought i best tell you all this as it might be very improtant lol
|