PHP - Html Within Php Not Showing
Hello all,
I am trying to get a simple members.php page to show some HTML but I cannot figure out why it will not display.. Code: [Select] <?php mysql_connect("myserver", "myname", "mypass") or die(mysql_error()); mysql_select_db("mydb") or die(mysql_error()); if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM Users WHERE name = '$name'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($password != $info['password']) { header("Location: login.php"); } else { ?> <html> <body> <h1>WHY</h1> </body> </html> <?php } } } else { header("Location: login.php"); } ?> I was googling and read somewhere that it might be a session bug after the initial '<?php tag'? Any help would be greatly appreciated Tokae Similar Tutorials<?php include 'includes/header.php'; include 'includes/navbar.php'; include 'includes/leftSidebar.php'; ?> <?php if(isset($_GET['update'])){ $the_mentor_id = $_GET['update']; $query = "SELECT * FROM mentor WHERE mentor_id = '$the_mentor_id' "; $update_mentor = mysqli_query($db, $query); while ( $row = mysqli_fetch_assoc($update_mentor) ) { $mentor_id = $row['mentor_id']; ?> <h1>i am h1</h1> <?php } } ?> <?php include 'includes/footer.php'; ?> Why <h1> I am h1</h1> this line is not showing, I am totally new in PHP , Please Help me The php web video script that I'm using displays user/member account pages in google searches. For example, the url displaying the page is the https://webvideosite.com/@chrisj I'm looking for guidance/suggestions on how to have the user/member account pages not appear in searches, either by blocking that somehow, or only having access to it if you are logged into the site. I look forward to any replies sorry, this is kinda annoying to look at but its the best way to show my problem... this : Code: [Select] $headers = "From: $email_from\r\n"; $headers .= "Content-type: text/html\r\n"; $email_message ='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' .'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' .'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Do you see the '! ' ?? why why why why why why?!?!?! I'm going freaking crazy trying to figure this out!!!! Thanks a billion in advanced! Nick Hello! I have this code Code: [Select] <?php include_once('../database_connection.php'); $thiskeyword = addslashes($_REQUEST['keyword']); $sqlquery = "Select * from nba_info where player_id like '%$thiskeyword' OR fname like '%$thiskeyword' OR lname like '%$thiskeyword' OR team like '%$thiskeyword' OR email like '%$thiskeyword'"; $result = MYSQL_QUERY($sqlquery); $numberOfRows = MYSQL_NUM_ROWS($result); ?> <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search Result</title> </head> <body><center><br /><br /> <?php if($numberOfRows==0) { die('You keywords haven\'t much any data from the database'); } else if($numberOfRows>0) { echo $numberOfRows. " Results have been found!"; $i = 0; ?> <table> <tr> <td>player_id</td> <td>fname</td> <td>lname</td> <td>team</td> <td>email</td> </tr> <?php while($i<$numberOfRows) { $player_id = MYSQL_RESULT($result,$i,"player_id"); $fname = MYSQL_RESULT($result,$i,"fname"); $lname = MYSQL_RESULT($result,$i,"lname"); $team = MYSQL_RESULT($result,$i,"team"); $email = MYSQL_RESULT($result,$i,"email"); ?> <tr> <td><? echo $player_id; ?></td> <td><? echo $fname; ?></td> <td><? echo $lname; ?></td> <td><? echo $team; ?></td> <td><? echo $email; ?></td> </tr> <?php $i++; } ?> </table> <?php } ?> <ul> <li><a href="/php/database/ManipulatingDatabase/add_database.php">Add New Player</a></li> <li><a href="/php/database/ManipulatingDatabase/edit_form.php">Edit Player</li> <li><a href="/php/database/ManipulatingDatabase/delete_form.php">Delete Player</li> <li><a href="/php/database/ManipulatingDatabase/search_form.php">Search Player</li> <li><a href="/php/database/ManipulatingDatabase/manipulate_database.php">BACK TO MAIN</a></li> </ul> </center> </body> </html> I have no problem with the sql statement as code Code: [Select] echo $numberOfRows. " Results have been found!"; is giving me a numbers of rows. The problem is the rows that have been found is not showing up in the html row. I wonder what the problem is.. anyone? I have a simple contact form with a textarea field, where the visitor can type a message in. However, if the user enters paragraphs or any type of line breaks, then the email that is sent shows the "\r\n" characters. I've tried using the nl2br function to no avail. Here's a sample code snippet: Code: [Select] $message = $_POST["message"]; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: '. $_POST["email"]; mail($to, $subject, $message, $headers); Am I missing something? Besides the "\r\n" characters showing, everything else works fine. I was wondering how does one go about showing results from SELECT query in columns in a html table. I have a list of products in a table, and would like to show them on the page in 4 columns. I have done many searches on google to try and find the sulution, but the majority of what im finding instead is about displaying a table from phpmyadmin as a table in html. If its a large operation to do this, I would be very happy if someone could poiint me in the direction of a tutorial maybe. Here is the code I have so far to display the products, but for some reason, it only show 1 row instead of all the rows from my table. Code: [Select] <?php $dbhost = "localhost"; $dbuser = "user"; $dbpass = "pass"; $dbname = "dbname"; mysql_connect ($dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $result = mysql_query("SELECT * FROM mcproducts"); while($row = mysql_fetch_array($result)) { $products_local_id = $row['products_local_id']; $productname = $row['product_name']; $thumburl = $row['image_from_url']; $productlink = $row['product_local_url']; $thumbnail = $row['product_image_small']; $currencysymbol = $row['product_currency']; $price = $row['product_price']; $flagicon = $row['product_country_from']; } ?> <html> <head> <link href="style/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="displaybox"> <div class="productimage"> <a href="<?php echo $productlink; ?><?php echo $products_local_id; ?>"><img src="<?php echo $thumburl; ?><?php echo $thumbnail ?>" width="150" height="150"></a> </div> <div class="productdescription"> <div class="pro_name"> <a href="<?php echo $productlink ?><?php echo $products_local_id; ?>"><?php echo $productname; ?></a> </div> <div class="pro_description"> </div> <?php if ($flagicon=="Ireland") { $flagicon = "<img src=\"flags/ireland.jpg\">"; } elseif ($flagicon=="UK") { $flagicon = "<img src=\"flags/uk.jpg\">"; } else echo ""; ?> <div class="pro_description"><?php echo $flagicon; ?><?php echo $currencysymbol ?> <?php echo $price ?></div> </div> </div> </body> </html> Many thanks, DB I am pretty new to PHP and am trying to create a simple (so I assumed) page to takes data from one html page(works fine) and updates a MYSQL Database. I am getting no error message, but the connect string down to the end of the body section is showing up as plain text in my browser window. I do not know how to correct this. I have tried using two different types of connect strings and have verified my names from the HTML page are the same as listed within the php page. Suggestions on what I need to look for to correct would be great. I have looked online, but so far all I am getting is how to connect, or how to create a comment, so I thought I would try here. Thank you for any assistance I may get!! - Amy - Code: [Select] <body><font color="006600"> <div style="background-color:#f9f9dd;"> <fieldset> <h1>Asset Entry Results</h1> <?php // create short variable names $tag=$_POST['tag']; $serial=$_POST['serial']; $category=$_POST['category']; $status=$_POST['status']; $branch=$_POST['branch']; $comments=$_POST['comments']; if (!$tag || !$serial || !$category || !$status || !$branch) { echo "You have not entered all the required details.<br />" ."Please go back and try again."; exit; } if (!get_magic_quotes_gpc()) { $tag = addslashes($tag); $serial = addslashes($serial); $category = addslashes($category); $status = addslashes($status); $branch = addslashes($branch); $comments = addslashes($comments); } //@ $db = new mysqli('localhost', 'id', 'pw', 'inventory'); $db = DBI->connect("dbi:mysql:inventory:localhost","id","pw") or die("couldnt connect to database"); $query = "insert into assets values ('".$serial."', '".$tag."', '".$branch."', '".$status."', '".$category."', '".$comments."')"; $result = $db->query($query); if ($result) { echo $db->affected_rows." asset inserted into Inventory."; } else { echo "An error has occurred. The item was not added."; } $db->close(); ?> </fieldset> </div> </body> This happens from time to time and it really drives me crazy. I cannot get the problem to reproduce, although I have plenty of evidence that it is happening. I have a php page that pulls in some database from mssql formats it in a nice table then send via email to a 3rd party. All of that works great. What happens is in some of the emails the first column will show the table cell information for the next column. See example: Code: [Select] Mascaw Mar. 8, 2012 - 6:15 pm Ronnie Johnson Newtown Pike<td width="150"> Mar. 8, 2012 - 6:15 pm Todd Doe Hall of Justice Mar. 8, 2012 - 6:15 pm Carol French I had this problem before with another emailing system and found that wrapping the email to 900 before sending it out fixed it. I wrapped this with $message = wordwrap($message, 900, "\n", true);() but it doesn't seem to make a difference. Anyone ran into this before? Any help would be greatly appreciated! Thanks I decided to redo the individual roster page I have on my site and came up with this. <?php if(isset($_GET['username']) && $_GET['username'] != '') { $username = $_GET['username']; $query = "SELECT bio.username AS username, bio.charactername AS charactername, bio.id AS id, bio.style_id AS style FROM `efed_bio` AS bio ON bio.id = ebw.bio_id WHERE bio.username = '$username'"; if(!$result = mysql_query($query)) while ($row = mysql_fetch_assoc($result)) { $fieldarray=array('id','username','charactername','style'); foreach ($fieldarray as $fieldlabel) { if (isset($row[$fieldlabel])) { $$fieldlabel=$row[$fieldlabel]; $$fieldlabel=cleanquerydata($$fieldlabel); } } } } ?> <h1><?php echo $charactername; ?>'s Biography</h1> <?php echo getBioMenu($style,$username); ?> <? //If the GET page variable is biography, display the biography page if ($page == 'biography') { echo getBiopgrahy($style,$id); } //Or if the GET page variable is gallery, display the gallery page elseif ($page == 'gallery') { echo getGallery($style,$id); } //If the GET page variable is news, display the news page elseif ($page == 'news') { echo getNews($$id); } //If the GET page variable is segments, display the segments page elseif ($page == 'segments') { echo getBioSegments($id,S); } //If the GET page variable is matches, display the matches page elseif ($page == 'matches') { echo getBioSegments($id,M); } elseif ($page == 'chronology') { echo getChronology($id); } //Otherwise display the bio else { echo getBio($style,$id); } ?> The list of characters are listed he http://kansasoutlawwrestling.com/roster An example of someone's individual roster page is located he http://kansasoutlawwrestling.com/bio?username=oriel hi all I have a table which i have got results from a database. My question If i want to display the details of a particular row. How do I do that? Thanks Rgds Hey all, Been coding another script for my website which allows me to update a users Rank, allthough, when I try and view the page its giving me a White Blank Page. I carn't accually see whats wrong in my Script... <?php session_start(); include ("../includes/config.php"); include ("../includes/function.php"); logincheck(); ini_set ('display_errors', 1); error_reporting (E_ALL); $username = $_SESSION['username']; // Owner Script - Change Users Rank $userlevel = mysql_query ("SELECT * FROM users WHERE username = '$username' LIMIT 1") or die ("Error Finding Right Users " . mysql_error()); $levelright = mysql_fetch_object($userlevel); // If userlevel isn't 5, move them on... if ($levelright->userlevel == "1" || $levelright->userlevel == "2" || $levelright->userlevel == "3" || $levelright->userlevel == "4"){ header ("Location: 404.php"); die(); } // Start Change Rank... if (strip_tags($_POST['changerank'])){ $name = $_POST['name']; $userchange = $_POST['userchange']; $real = mysql_query ("SELECT * FROM users WHERE username = '$userchange' LIMIT 1"); $number = mysql_num_rows($real); if ($number != "1"){ echo ("$userchange, is NOT registered! - Simple Words : No Such User!"); } if ($name == 1){ $reprand = rand(100, 50000); mysql_query ("UPDATE users SET rank = 'Learner Driver (1)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 1 if ($name == 2){ $reprand = rand(50000, 200000); mysql_query ("UPDATE users SET rank = 'Passed Driver (2)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 2 if ($name == 3){ $reprand = rand(200000, 500000); mysql_query ("UPDATE users SET rank = 'New Driver (3)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 3 if ($name == 4){ $reprand = rand(500000, 2500000); mysql_query ("UPDATE users SET rank = 'Speeding Driver (4)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 4 if ($name == 5){ $reprand = rand(2500000, 7000000); mysql_query ("UPDATE users SET rank = 'Skilled Driver (5)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 5 if ($name == 6){ $reprand = rand(7000000, 20000000); mysql_query ("UPDATE users SET rank = 'Maniac Driver (6)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 6 if ($name == 7){ $reprand = rand(20000000, 45000000); mysql_query ("UPDATE users SET rank = 'Wanted Racer (7)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 7 if ($name == 8){ $reprand = rand(45000000, 90000000); mysql_query ("UPDATE users SET rank = 'Pro Driver (8)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 8 if ($name == 9){ $reprand = rand(90000000, 115000000); mysql_query ("UPDATE users SET rank = 'Supreme Racer (9)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 9 if ($name == 10){ $reprand = rand(115000000, 150000000); mysql_query ("UPDATE users SET rank = 'Super Supreme Racer (10)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 10 if ($name == 11){ $reprand = rand(150000000, 210000000); mysql_query ("UPDATE users SET rank = 'Show Off Driver (11)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 11 if ($name == 12){ $reprand = rand(210000000, 280000000); mysql_query ("UPDATE users SET rank = 'Extreme Show Off Driver (12)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 12 if ($name == 13){ $reprand = rand(280000000, 350000000); mysql_query ("UPDATE users SET rank = 'Trained Driver (13)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 13 if ($name == 14){ $reprand = rand(350000000, 430000000); mysql_query ("UPDATE users SET rank = 'Super Trained Driver (14)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 13 if ($name == 15){ $reprand = rand(430000000, 520000000); mysql_query ("UPDATE users SET rank = 'Legendry Racer (15)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 15 if ($name == 16){ $reprand = rand(520000000, 600000000); mysql_query ("UPDATE users SET rank = 'Most Legendry Racer (16)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 16 if ($name == 17){ $reprand = rand(600000000, 1000000000); mysql_query ("UPDATE users SET rank = 'Official SD Legend (17)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 17 if ($name == 18){ $reprand = rand(1000000000, 1000000010); mysql_query ("UPDATE users SET rank = 'Hidden Rank! (18)' AND rep = '$reprand' WHERE username = '$userchange'") or die ("Error Updating rank " . mysql_error()); } // Name 18 echo ("Successfully updated $userchange Rank!"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$userchange', 'System', 'Your Rank has now been changed!', '$date', '0', '0', '0')") or die ("Error updating there inbox!" . mysql_error()); } // Rank Change if (strip_tags($_POST['selectname'])){ $writenname = $_POST['nameinput']; $rankinput = $_POST['rankinput']; $repinput = $_POST['repinput']; $findme = mysql_query ("SELECT * FROM users WHERE username = '$writenname' LIMIT 1") or die ("Error Searching Names " . mysql_error()); $found = mysql_num_rows($findme); if ($found != "1"){ echo ("$writenname, isn't Registered! - Simple Terms : No Such User"); }else{ mysql_query ("UPDATE users SET rank = '$rankinput' AND rep = '$repinput' WHERE username= '$writenname'") or die ("Error Updating Rank + Rep " . mysql_error()); echo ("$writenname Rank has now been changed!"); mysql_query("INSERT INTO `inbox` ( `id` , `to` , `from` , `message` , `date` , `read` , `saved` , `event_id` ) VALUES ( '', '$writenname', 'System', 'Your Rank has now been changed!', '$date', '0', '0', '0')") or die ("Error updating there inbox!" . mysql_error()); } // Found? } // Post selectname ?> <html> <head> <title>Change Users Rank</title> </head> <body class='body'> <form action='' method='POST' name='Change Rank'> <table width='40%' border='1' cellpadding='0' cellspacing='0' class='table' align='center'> <tr> <td class='header' align='center' colspan='2'>Change Users Rank?</td> </tr> <tr> <td class='omg' align='center'>This will change the users Current Rank!</td> </tr> <tr> <td align='right'>Username:</td><td><input type='text' name='userchange' class='input'></td> </tr> <tr> <td><select name='name' size='1' class='dropbox'> <option value="1">Learner Driver (1)</option> <option value="2">Passed Driver (2)</option> <option value="3">New Driver (3)</option> <option value="4">Speeding Driver (4)</option> <option value="5">Skilled Driver (5)</option> <option value="6">Maniac Driver (6)</option> <option value="7">Wanted Racer (7)</option> <option value="8">Pro Driver (8)</option> <option value="9">Supreme Racer (9)</option> <option value="10">Super Supreme Racer (10)</option> <option value="11">Show Off Driver (11)</option> <option value="12">Extreme Show Off Driver (12)</option> <option value="13">Trained Driver (13)</option> <option value="14">Super Trained Driver (14)</option> <option value="15">Legendry Racer (15)</option> <option value="16">Most Legendry Racer (16)</option> <option value="17">Official SD Legend (17)</option> <option value="18">Hidden Rank! (18)</option></td> </tr> <tr> <td class='omg' align='center' colspan='2'><input type='submit' name='changerank' class='button'></td> </tr> </table> <br /> <table width='40%' border='1' cellpadding='0' cellspacing='0' class='table' align='center'> <tr> <td class='header' align='center' colspan='2'>Change Rank?</td> </tr> <tr> <td class='omg' align='center'>This will change the <strong>posted</strong> users Rank and Rep!</td> </tr> <tr> <td align='right'>Username:</td><td><input type='text' name='nameinput' class='input'></td> </tr> <tr> <td align='right'>Rank:</td><td><input type='text' name='rankinput' class='input'></td> </tr> <tr> <td align='right'>Rep:</td><td><input type='text' name='repinput' class='input'></td> </tr> <tr> <td align='center' colspan='2'><input type='submit' name='selectname' class='button'></td> </tr> </table> </form> </body> </html> Anyone able to see where I'm going wrong? Thanks Hi, I am using the include function to link my header and menu up to my files. My folder structure is: WWW Folder -head.html -menu.html -homepage.php Images Folder Blog Folder -index.php The head.html and menu.html have links to images kept within the images folder. homepage.php and index.php both have include functions to include the menu and header thus including the images. homepage.php works fine the images show up however blog.php links to the head and menu but does not show up the images. my include function for index.php is: <?php include ("..\menu.html"); ?> I have attached a print screen of what the index.php looks like, its obvious that its picking up the head and menu as its showing the image names but not showing the images. Can anybody help it's really confusing me? Thanks Hi guys
I am using the code below to show distinct months using one query then for each month I am trying to show a list of fixtures for the month, the problem I have is only one month is showing.
where am i going wrong?
<?php //find distinct months $sql="SELECT DISTINCT MONTH( match_date ) AS MONTH FROM tbl_fixtures WHERE season_id =$current_season UNION SELECT DISTINCT MONTH( match_date ) AS MONTH FROM tbl_gp WHERE season_id =$current_season"; $result=mysqli_query($dbConn, $sql); if(mysqli_num_rows($result)>0){ while($row=mysqli_fetch_assoc($result)){ $month=$row['MONTH']; echo '<div class="fixtureMonth"> <h2>'.$months[$month].'</h2> </div> <div class="fixtures">'; //find fixtures for month $sql="SELECT Opposition, match_date, competition, tbl_clubs.club_name AS club, image, HomeAway, team, opposition_points, points FROM tbl_fixtures INNER JOIN tbl_clubs ON tbl_fixtures.club = tbl_clubs.club_id WHERE season_id =$current_season and MONTH(match_date)=$month UNION SELECT Opposition, match_date, \"SGP\" AS competition, \"SGP\" AS club, \"sgp.png\" AS image, \"\" as HomeAway, \"\" as team, \"\" as opposition_points, points FROM tbl_gp WHERE season_id =$current_season and MONTH(match_date)=$month ORDER BY match_date"; $result=mysqli_query($dbConn,$sql)or die(mysqli_error($dbConn)); if(mysqli_num_rows($result)==0){ echo no_fixtures_found; } else{ echo '<table class="fixturesTable">'; while($row=mysqli_fetch_assoc($result)){ echo'<tr> <td>'.date("d-M-Y",strtotime($row['match_date'])).'</td> <td><img src="'.$shopConfig['url'].'images/'.$row['image'].'"/></td> <td>'.$row['Opposition'].'</td> <td>'.$row['HomeAway'].'</td> <td><b>'.$row['team'].'</b>-'.$row['opposition_points'].'</td> <td>'.$row['team'].'</td> </tr>'; } echo '</table>'; } echo '</div>'; } } ?> hello team, can you please look at this code snippet and tell me why it is showing the following data this way? <?php # jeff Exp $ include("app.php"); $page->set("title", "Business & Commerical"); $what = $page->getvar("what"); $type = $page->getvar("type"); $dt = new xDataTable('width="500"'); $form = new Form(); if($what == "submit") $html->set("readonly", true); $dt->header($_types{$type} . " Quote"); $form->get_contact_form(true); When I run it, it shows like this: set("title", "Business & Commerical"); $what = $page->getvar("what"); $type = $page->getvar("type"); $dt = new xDataTable('width="500"'); $form = new Form(); if($what == "submit") $html->set("readonly", true); $dt->header($_types{$type} . " Quote"); $form->get_contact_form(true); switch ($type) { case "comp": $dt->left("Business Type:"); $dt->cell($html->select("business_type", $_business_type, 1, "", $page->getvar("business_type"), "(select)")); $dt->left("Federal Tax ID:"); $dt->cell($html->textfield("tax_id", $page->getvar("tax_id"), 12)); $dt->left("If Individual, Owner SSN#:"); $dt->cell($html->textfield("ssn", $page->getvar("ssn"), 12)); $dt->cell("Spouse SSN#:"); $dt->cell($html->textfield("spouse_ssn", $page->getvar("spouse_ssn"), 12)); just a small sample. What am I doing wrong? Thanks alot in advance Hello: I have this bit of code in the works (which does not work): Code: [Select] <?php if ( $mySubHeader; != "" ) { echo " <h2> <?php echo $mySubHeader; ?> </h2> "; } What I am trying to do is to show the H2 tag only if it has a value from the database. Otherwise, I do not want to show it. What is the correct way to do this? Thanks. The following code should output 1743425391, but it does not show anything <?php $xml_feed_url = 'http://api.eve-online.com/eve/CharacterID.xml.aspx?names=TX1'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $xml_feed_url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $xml = curl_exec($ch); curl_close($ch); $xmlr = new SimpleXMLElement($xml); $charid = $xmlr->result->characterID; echo $charid; ?> The xml is: Code: [Select] <eveapi version="2"> <currentTime>2011-02-01 05:22:38</currentTime> − <result> − <rowset name="characters" key="characterID" columns="name,characterID"> <row name="TX1" characterID="1743425391"/> </rowset> </result> <cachedUntil>2011-03-01 05:22:38</cachedUntil> </eveapi> Any ideas where I went wrong? Hi Friends, I have form in that i am sending some values using POST method. But i cant able to get values using $_POST['var'] or $_REQEUST['var'] Data is not coming in IE6, But it is coming in firefox and other browsers even in IE8. What may be problem? any settings i have to make for IE6. ? Any suggestions i have the following code: <?php session_start(); include "connect.php"; $queryFinished = mysql_query("SELECT * FROM `finished` ORDER BY auctionID DESC LIMIT 10;") or die(mysql_error()); $queryAdmin = mysql_query("SELECT maxClosed FROM `admin`;") or die(mysql_error()); //echo $queryAuctionID." = Auction ID<br />"; $username = mysql_fetch_assoc($queryFinished); $queryShip = mysql_query("SELECT * FROM ships WHERE typeName='$username[itemName]';") or die(mysql_error()); $getShip = mysql_fetch_assoc($queryShip); $shipID = $getShip[typeID]; echo "<img src='http://image.eveonline.com/Character/".$username[charid]."_32.jpg'> <span class='eveyellow'>".$username[username]."</span> has won a <img src='/images/types/shiptypes_png/32_32/".$shipID.".png'/> ".$username[itemName]." with ticket number #".$username[ticketNumber]."<br />"; ?> it basically lists the most recent auctions that have won, but even though i set the query to LIMIT by 10 it still only shows the 1? is something above sticking out to anyone? i know it looks messy but im still learning. Hi all, I have a simple upload form which is just to upload an image to a folder, this all works fine apart from one bit, once the image has been submitted then a box appears thanking the user for their upload and a close box link, then the original form also appears! I dont want this to appear once I file has been uploaded. I thought my below code would achieve that with an if statement but it is not working: <?php session_start(); $user_id = $_SESSION['user_id']; if (file_exists($user_id.'.'.$extension)) { define ("MAX_SIZE","100"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if(isset($_POST['Submit'])) { $image=$_FILES['image']['name']; if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { $size=filesize($_FILES['image']['tmp_name']); if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } $image_name=$user_id.'.'.$extension; $newname="romimages/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; }}}} if(isset($_POST['Submit']) && !$errors) { ?> <link href="../Styles/form_dark.css" rel="stylesheet" type="text/css" /> <form class="dark" action="" method="post" > <ol> <li> <fieldset> <legend>Rom Logo Uploaded!</legend> <p> </p> <ol> <li> <label for="">Your image has been uploaded, you can now close this window</label> </li> </ol> </fieldset> </li> </ol> <br> <input type="submit" value="Close" name="submit" onClick="return parent.parent.GB_hide()" > </p> </form> <?php } } else { ?> <link href="../Styles/form_dark.css" rel="stylesheet" type="text/css" /> <form method="post" enctype="multipart/form-data" action="" class="dark"> <ol> <li> <input type="file" name="image" width="45px"> </li><br> <br> <li> <input name="Submit" type="submit" value="Upload image"> </form> <?php } ?> thanks I am developing hospital managment system using php. I have IPD data sheet. When I select patient it is not showing pt data as it should do. Please let me know if any coding needs to place here. I am new to PHP. Below is my code <?php //create array to temporarily grab variables $input_arr = array(); //grabs the $_POST variables and adds slashes foreach ($_POST as $key => $input_arr) { $_POST[$key] = addslashes($input_arr); } ?> <?php session_start(); $db = mysqli_connect('localhost', 'root', '', 'ratanba_new'); // initialize variables $reg_no = ""; $name = ""; $father_name = ""; $sir_name = ""; $sex = ""; $age = ""; $full_name = ""; $dob = ""; $update = false; $patient_master_id = ""; $ipd_id = 0; $IPNo = ""; $fees = ""; $opd_date = ""; $pulse = ""; $bps = ""; $bpd = ""; $weight = ""; $spo2 = ""; if (isset($_POST['admit'])) { function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); $data = ucwords($data); return $data; } $patient_master_id = $_POST['patient_master_id']; $IPNo = $_POST['IPNo']; $RegNo = $_POST['reg_no']; $Name = $_POST['Name']; $Age = $_POST['Age']; $Sex = $_POST['sex']; $Contact1 = $_POST['Contact1']; $Relation1 = $_POST['Relation1']; $Mobile1 = $_POST['Mobile1']; $Contact2 = $_POST['Contact2']; $Relation2 = $_POST['Relation2']; $Mobile2 = $_POST['Mobile2']; $Adate = $_POST['Adate']; $Award = $_POST['Award']; mysqli_query($db, "INSERT INTO IPD (IPNo, RegNo, Name, Age, Sex, Contact1, Relation1, Mobile1, Contact2, Relation2, Mobile2, Adate, Award) VALUES ('$IPNo', '$RegNo', '$Name', '$Age', '$Sex', '$Contact1', '$Relation1', '$Mobile1', '$Contact2', '$Relation2', '$Mobile2', NOW(), '$Award')"); $_SESSION['message'] = "New Admission Successfull !"; header('location: ../ipd.php'); } if (isset($_POST['Discharge'])) { $ipd_id = $_POST['ipd_id']; $Outcome = $_POST['Outcome']; mysqli_query($db, "UPDATE ipd SET Outcome='$Outcome', Ddate=NOW() WHERE ipd_id=$ipd_id"); $_SESSION['message'] = "Patient discharged Successfull !"; header('location: ../ipd.php'); } if (isset($_POST['final_discharge'])) { $ipd_id = $_POST['ipd_id']; $History = $_POST['History']; $Examination = $_POST['Examination']; $Investigation = $_POST['Investigation']; $Advise = $_POST['Advise']; $Diagnosis = $_POST['Diagnosis']; $Treatment = $_POST['Treatment']; $Operation = $_POST['Operation']; $OTnote = $_POST['OTnote']; $Condition1 = $_POST['Condition1']; $Note = $_POST['Note']; mysqli_query($db, "UPDATE ipd SET History='$History', Examination='$Examination', Investigation='$Investigation', Diagnosis='$Diagnosis', Operation='$Operation', OTnote='$OTnote', Condition1='$Condition1', Advise ='$Advise', Treatment='$Treatment', Note='$Note' WHERE ipd_id=$ipd_id"); $_SESSION['message'] = "Discharge saved Successfull !"; header('location: ../doctor/discharge.php'); } $results = mysqli_query($db, "SELECT * FROM IPD "); ?> Edited May 8 by Barand Coding was missed |