URGENT:! Echo don´t work as supposed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

URGENT:! Echo don´t work as supposed

Post by Goofan »

Code:

Code: Select all

<form action="Home.php?Action="<?php echo $Action; ?>." method="post" ENCTYPE="multipart/form-data">
This will show in the URL:
http://localhost/***/Home.php?Action=

Please help (What am i doing wrong?)
db579
Forum Commoner
Posts: 37
Joined: Sun Jul 18, 2010 6:23 pm

Re: URGENT:! Echo don´t work as supposed

Post by db579 »

I'm not sure what's happening with yours but I'd suggest trying

Code: Select all

 <?php

echo "<form action='Home.php?Action=$Action' method='post' ENCTYPE='multipart/form-data'>";
?>
See if that gets you any further
shawngoldw
Forum Contributor
Posts: 212
Joined: Mon Apr 05, 2010 3:38 pm

Re: URGENT:! Echo don´t work as supposed

Post by shawngoldw »

echo works fine, $Action must not be defined there. Also, why is there a " before <?php and a . after ?>

Provide some more code, it will be helpful.


Shawn
User avatar
Goofan
Forum Contributor
Posts: 305
Joined: Wed Nov 04, 2009 2:11 pm
Location: Sweden

Re: URGENT:! Echo don´t work as supposed

Post by Goofan »

I got an input to the action, and i got <php... and an end but still it outputs clean... what might be the problem? nothing wrong with that point of the code?



To provide with full code i assign this code:

Code: Select all

<?php session_start() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
	//User checking\\
	if ($_SESSION["inloggning"] == true){
	}elseif ($_SESSION["inloggning"] == false){
		header("Refresh: 5; url=Index.php");
		exit();
	}
	
 	//Includes\\
 	require_once('Menu-OOP.php'); 
	  $Action = ($_GET['Action']);
	require_once('database/OOP.Database.Login.php'); 
	  $db = new database() 
?>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>Banner - Home</title>
	<link href="Style.css" rel="stylesheet" type="text/css">
 </head>
 <body>
 <form action="" method="post" ENCTYPE="multipart/form-data">
     <p class="PosFixedTop1">
         <div class='BoxLeft'>
             <?php
                if (isset($_POST["Submit"])){
                    if ($_POST['message'] == "") {
                    }else{
                        $Msg = $_POST['message'];
						$mysql = "INSERT INTO instant_message (message) VALUES ('$Msg')";
						$query = $db->dbquery($mysql);
						
						$mysql = "SELECT * FROM instant_message";
						$result = $db->dbquery($mysql);
						
						while($array = $db->fetchArray($result)){
							$db_Msg = $array['message'];
						}
						echo "<b class='Color'>$db_Msg</b>";
                    }
                }
             ?>
         </div>
     </p>
     	 
     <p class="PosFixedTop2">
     	<div class='BoxRight'>
             <b class='Color'>Message: </b>
             <input type="text" name="message">
             <input name="Submit" type="submit" value="Submit">
         </div>
     </p>
 </form>
     
     <table width="100%" height="100%" cellspacing="1">
     	<td height="25px">
        </td>
         <tr>
         </tr>
         <tr>
             <td width="15%" height="100%" valign="top">
                <?php //Left Empty Side\\ ?>
             </td>
             <td>
                <table width="100%" height="100%" cellspacing="1">
                    <tr>
                        <td class="TdColor" colspan="2" height="130px" valign="top">
                            <?php //Top Picture\\ ?>
                        </td>
                    </tr>
                    <tr cellspacing='0'>
                        <td class="TdColor" width="18%" height="513px" valign="top">
                            <?php //Label Picture\\ ?>
                            
                            <?php //Menu\\ ?>
                        <p class="PosFixed">
                            <?php
                            	$links = new Index();
							?>
                        <br><b class="Color"> Menu </b><br>
                            <?php
								if ($Action == "Home") {
									
									echo implode('<br> ', $links->getLinks("Normal"));
								}
								elseif ($Action == "Overview") {
									
									echo implode('<br> ', $links->getLinks("SubOne"));
								}
								elseif ($Action == "LinkTwo") {
	
									echo implode('<br> ', $links->getLinks("SubTwo"));
								}
								elseif ($Action == "LinkThree") {
						   
									echo implode('<br> ', $links->getLinks("SubThree"));
								}
								
							?>
                        </p>
                        </td>
                        <td class="TdColor" valign="top"> 
     						<?php //Top\\ ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="15%" valign="top">
                <?php //Right Empty Side\\ ?>
            </td>
         </tr>
         <tr>
         </tr>
 	</table>
 </body>
 </html>
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: URGENT:! Echo don´t work as supposed

Post by s.dot »

Access $Action using $_GET['Action']
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
tof
Forum Newbie
Posts: 1
Joined: Wed Oct 06, 2010 10:09 am

Re: URGENT:! Echo don´t work as supposed

Post by tof »

You just seem to have one double-quote after Action= that you have to remove and the dot (".") before method=
the right syntax is this :
<form action="Home.php?Action=<?php echo $Action; ?>" method="post" ENCTYPE="multipart/form-data">
Post Reply