PHP - Universal Variables?
I'm new to PHP (I've done some of the basic stuff, but I'm far from anything too advanced).
I'm looking to make a site with some Universal (not user specific) variables which can be configured in a control panel, but I just don't know where to begin. To give an example of what I'm looking to do: In the header.php, for instance, I'd like to allow the admin an option to display either the company logo (png) or the company name in text format. They would chose which of the two options they want (and fill out what the "company name" should be) in a separate config.php page. So, in essence, I suppose what I'm asking is "1) How do I make a configuration form store data indefinitely? 2) How do I make other pages reference that data?" Similar Tutorialshey @requinix, I know you and I have talked about this before but I just want to clarify this issue. Sadly, I have produced very few websites that have made use of dynamics in the form of database querying. But, the next project that I'm looking at will require it. The last thing I did with a query string involved the recording of downloads of file on a website. and on the page, I had this code: The archive is located he <a href="dl.php?f=archive.zip">archive.zip</a> and the ''dl'' page had this code: if(!$_GET['f']) error('Missing parameter!'); $stmt = $conn->prepare("INSERT INTO tblDownloads (ip, file, date, time) VALUES (?, ?, ?, ?)"); $stmt->bind_param("ssss", $ip, $file, $date, $time); $stmt->execute(); $stmt->close(); $conn->close(); header("Location: archive.zip"); exit; and all the variables in the above ''dl'' page are declared in a file that is required by it, called ""conn.php"". My question for anyone here is: I am going to be producing a website similar to the testing site called ""jsFiddle"": https://jsfiddle.net/ . And it is slated to have a huge amount of content on it. for example, a main page might have 100 links on it whereby, if a user clicks on any of them, it should take them to another page (or load async content) that illustrates and example of any given issue being asked about. So, I know we've talked about $_GET before Requinix, and how most websites use it to produce dynamic content. And we've also talked about the concept of markdown. But once again, can someone here remind me....what's the best way to go about doing this? Storing the actual ""answer to the issue"" content in a backend database and pulling/displaying it appropriately, kind of like what I am showing I did with the file in the above code? thanks. Adam Edited September 6, 2020 by ajetrumpetMost of the websites I have built have not been large and not dynamic in nature, but I need to make one now with a boatload of content on it. and I’m needing a little resource help where I can research something. I’m sure all developers do this, and I know I need a massive database or 2 and the PHP knowledge I already have, but I’m just looking for a little guidance about how to do this the easiest way. It may actually sound like a stupid question and I might be over-thinking a bit. So… Lets say I have 500 articles that I want to make available to a site visitor and give them the option to choose what they want to look at through nav menus and submenus. I want the same page to display to the user, regardless of what article is chosen. how does PHP play a part in that? Would I be right by saying the following? If the home page had this content on it: This website is a course in PHP coding. <a href="courseTemplate.php" target="_blank">Click here</a> to view course #1. and I wanted all the course content to be displayed through the use of the “courseTemplate.php” file, how simple is that? I would assume that these types of things would be the results and the techniques to accomplish the goal, right? => a resulting URL that looks like this: www.site.com/courseTemplate.php?id=1 => storing all the text of the course material in one single field of a DB record. NOT storing the layout-oriented code (HTML, etc.) and echoing it out with the rest of the text. => making use of the GET() function somehow to pull the course’s text content out of the database. Can someone show me a website that demonstrates this? I don’t think this is very difficult, and I’m sure there are web resources available that show how this is done. I’m almost sure that most news agency websites do this, and I know for a fact that most forum software has this template technique written into it, regardless if SEO is included or not. Sorry for the basic nature of this question. I know some of my previous posts have been such where I’ve asked much more difficult questions than this. I have seen youtube tutorials on issues similar to this, but nothing pulled up by google really shows this in a very simplistic nature. thanks. I have a boostrap conflict regarding box sizing. I solved it with a simple CSS rule:
* { box-sizing: content-box; }Now the problem is my bootstrap form isn't working. I need to make the box sizing apply to everything except the bootstrap form: <form id="contactForm" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES); ?>" method='post'> <!-- HTML HERE --> </form>Any ideas? Thanks. does anyone know how to decode this XML variable value into string values? I also need to know the oposite way: creating variable values into xml. I've tried several code examples but they did filter the requested data. Code: [Select] $xml='<?xml version="1.0" encoding="utf-8"?> <elements> <text identifier="ed9cdd4c-ae8b-4ecb-bca7-e12a5153bc02"> <value/> </text> <textarea identifier="a77f06fc-1561-453c-a429-8dd05cdc29f5"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <textarea identifier="1a85a7a6-2aba-4480-925b-6b97d311ee6c"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <image identifier="ffcc1c50-8dbd-4115-b463-b43bdcd44a57"> <file><![CDATA[images/stories/red/cars/autobedrijf.png]]></file> <title/> <link/> <target/> <rel/> <lightbox_image/> <width><![CDATA[250]]></width> <height><![CDATA[187]]></height> </image> <text identifier="4339a108-f907-4661-9aab-d6f3f00e736e"> <value><![CDATA[Kramer 5]]></value> </text> <text identifier="ea0666d7-51e3-4e52-8617-25e3ad61f8b8"> <value><![CDATA[6000 RS]]></value> </text> <text identifier="90a18889-884b-4d53-a302-4e6e4595efa0"> <value><![CDATA[Eindhoven]]></value> </text> <text identifier="410d72e0-29b3-4a92-b7d7-f01e828b1586"> <value><![CDATA[APK Pick up and return]]></value> </text> <text identifier="45b86f23-e656-4a81-bb8f-84e5ea76f71f"> <value><![CDATA[15% korting op grote beurt]]></value> </text> <text identifier="3dbbe1c6-15d6-4375-9f2f-f0e7287e29f3"> <value><![CDATA[Gratis opslag zomerbanden]]></value> </text> <text identifier="2e878db0-605d-4d58-9806-8e75bced67a4"> <value><![CDATA[Gratis abonnement of grote beurt]]></value> </text> <text identifier="94e3e08f-e008-487b-9cbd-25d108a9705e"> <value/> </text> <text identifier="73e74b73-f509-4de7-91cf-e919d14bdb0b"> <value/> </text> <text identifier="b870164b-fe78-45b0-b840-8ebceb9b9cb6"> <value><![CDATA[040 123 45 67]]></value> </text> <text identifier="8a91aab2-7862-4a04-bd28-07f1ff4acce5"> <value/> </text> <email identifier="3f15b5e4-0dea-4114-a870-1106b85248de"> <value/> <text/> <subject/> <body/> </email> <link identifier="0b3d983e-b2fa-4728-afa0-a0b640fa34dc"> <value/> <text/> <target/> <custom_title/> <rel/> </link> <relateditems identifier="7056f1d2-5253-40b6-8efd-d289b10a8c69"/> <rating identifier="cf6dd846-5774-47aa-8ca7-c1623c06e130"> <votes><![CDATA[1]]></votes> <value><![CDATA[1.0000]]></value> </rating> <googlemaps identifier="160bd40a-3e0e-48de-b6cd-56cdcc9db892"> <location><![CDATA[50.895711,5.955427]]></location> </googlemaps> </elements>'; Hi. I have some code which needs to return a single variable from the function and stored as a variable within this page, so it can be echoed later on in the page. I couldn't get it to return as a variable, so i used "return compact();" to return the variable and "extract (myFunction());" to extract it to variables. However, when I turned on php's display errors and error reporting function, I got an error message saying "Warning: extract() [function.extract]: First argument should be an array in /my/web/site/index.php on line 6" (which is where my extract function is). This works fine with passing more than one variables through, is there another way pass one variable from a function to be stored as a variable on the page which called the function? Here is the function: Code: [Select] <?php //This is a list of numeric error codes against their text. this will return the error code as the variable $issue function checkLoginIssue() { //If there is an error code if (isset($_GET["issue"])) { //cycle through the list until the code is reached, return the text and break the switch switch ($_GET["issue"]) { case "1": $issue = '<p class="warning">Please log in to view this page</p>'; break; case "2": $issue = '<p class="warning">Wrong Username or Password</p>'; break; case "3": $issue = '<p class="warning">No user found with those details</p>'; break; } //return the variable in an array with a single value return compact('issue'); } } ?> And here is the code which calls the function: Code: [Select] <?php extract(checkLoginIssue()); ?> I've got a select statement that looks like this in php. Code: [Select] $sql = "Select * from inventory where ".$fields."".$operator."".$criteria; Everything posts correctly, everything is dereferenced correctly. My only question is how do I get $criteria have single quotes around it? So that when I actually run the query it says select * from inventory where field = 'value'; I've tried Code: [Select] $sql = "Select * from inventory where ".$fields."".$operator.""'.$criteria'; $sql = "Select * from inventory where ".$fields."".$operator.""'$criteria'; and a bunch of variations like that. Thanks for you help. Hi guys, I've a developer for a pretty large website and forum, the database is exploding in size and we are now seeing a grow in the slow log. We want to be able to fix this by optimizing query's but the site is so big, we can't locate the query's themselfs as they are dynamically generated. I want to be able to tail onto the end of the query a comment containing where a function was last called. In the example below, I want the file name and line-number of where add_together() was called. Here is an example for index.php: Code: [Select] $a = 1; $b = 2; $c = add_together($a, $b); function add_together($a, $b) { return $a + $b; } Look forward to your assistance with this! Joe I'm running the latest stable version of PHP in Apache Server on Windows 7 64-bit.
It working fine and set up correctly.
I'd like to use ENVIRONMENT VARIABLES or a variable like "%current_directory%" or "..\%current_directory%" in the configuration files for PHP, php.ini.
Is this possible? Is php.ini a parsed file, can variables be define and used in it? Help would be much appreciated
I'm running the latest version of MySQL on Windows 7 64-bit.
It working fine and set up correctly.
I'd like to use ENVIRONMENT VARIABLES or a variable like "%current_directory%" or "..\%current_directory%" in the configuration files for MySQL, my.ini.
Is this possible? Is my.ini a parsed file, can variables be define and used in it? Help would be much appreciated
Hi guys I have two variables but $no1=$row[no1]; $no2=$row[no2]; I need to have another variable where i can merge these two as i need to insert them to database with sapce in between each variable like: $numbers= $no1 $no2; by doing this i get syntax error, do u know whats the best way to do this? Hello, Is it possible to use variables that are declared outside or plainly within a class, and if its possible, how? thanks in advance It echos that there are to many.. how would I do this Saying like if I had 100 $Variable[] it would echo that there are to many? $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; $Variable[] = ""; Hello I am stuck at a point where I need to call multiple numbers for a given API
This is the code provided by the API company
// Send Message
Now My html code would be
<div class="card-header ch-alt">
<div class="card-body card-padding">
<option value='APIKEY'>APIKEY Value </option> </select><br> <br><br>
Text: * <br>
Now how do I insert multiple numbers on the Destination number...when i give commas, it gives errors but the message goes with single number
Need hlp Hello I need some help please, I've started to teach myself PHP and I'm attempting to set up some matches for a league I run. I've included the link I'm working on and just cannot seem to fix my problem. I'm trying to get it so that you can put the team members and have their names come up in the match section. Any help would be wonderful cause I have to be doing something wrong I've also now included my PHP that I have...sorry should have put it first time http://www.4funmembers.com/Pairings.php Code: [Select] <?php if ( !$_POST['submit'] ) { echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"singles1.php\" target=\"_blank\">\n"; echo "<tr><td>Team 1 Name: <input type=\"text\" name=\"teamone\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1a\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2a\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3a\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4a\"/></td></tr>\n"; echo "<tr><td>Team 2 Name: <input type=\"text\" name=\"teamtwo\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1b\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2b\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3b\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4b\"/></td></tr>\n"; echo "<tr><td>Team 3 Name: <input type=\"text\" name=\"teamthree\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1c\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2c\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3c\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4c\"/></td></tr>\n"; echo "<tr><td>Team 4 Name: <input type=\"text\" name=\"teamfour\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1d\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2d\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3d\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4d\"/></td></tr>\n"; echo "<tr><td>Team 5 Name: <input type=\"text\" name=\"teamfive\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1e\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2e\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3e\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4e\"/></td></tr>\n"; echo "<tr><td>Team 6 Name: <input type=\"text\" name=\"teamsix\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1f\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2f\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3f\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4f\"/></td></tr>\n"; echo "<tr><td>Team 7 Name: <input type=\"text\" name=\"teamseven\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1g\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2g\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3g\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4g\"/></td></tr>\n"; echo "<tr><td>Team 8 Name: <input type=\"text\" name=\"teameight\"/></td></tr>\n"; echo "<tr><td>Player 1: <input type=\"text\" name=\"plyr1h\"/></td></tr>\n"; echo "<tr><td>Player 2: <input type=\"text\" name=\"plyr2h\"/></td></tr>\n"; echo "<tr><td>Player 3: <input type=\"text\" name=\"plyr3h\"/></td></tr>\n"; echo "<tr><td>Player 4: <input type=\"text\" name=\"plyr4h\"/></td></tr>\n"; echo "<tr><td>Match #1 <select name=\"teama\"><option value=\"t1\">Team 1</option>\n<option value=\"t2\">Team 2</option>\n<option value=\"t3\">Team 3</option>\n<option value=\"t4\">Team 4</option>\n<option value=\"t5\">Team 5</option>\n<option value=\"t6\">Team 6</option>\n<option value=\"t7\">Team 7</option>\n<option value=\"t8\">Team 8</option></select> vs <select name=\"teamb\"><option value=\"t1\">Team 1</option>\n<option value=\"t2\">Team 2</option>\n<option value=\"t3\">Team 3</option>\n<option value=\"t4\">Team 4</option>\n<option value=\"t5\">Team 5</option>\n<option value=\"t6\">Team 6</option>\n<option value=\"t7\">Team 7</option>\n<option value=\"t8\">Team 8</option></select></td></tr>\n"; echo "<tr><td>Match #2 <select name=\"teamc\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select> vs <select name=\"teamd\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select></td></tr>\n"; echo "<tr><td>Match #3 <select name=\"teame\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select> vs <select name=\"teamf\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select></td></tr>\n"; echo "<tr><td>Match #4 <select name=\"teamg\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select> vs <select name=\"teamh\"><option value=\"1\">Team 1</option>\n<option value=\"2\">Team 2</option>\n<option value=\"3\">Team 3</option>\n<option value=\"4\">Team 4</option>\n<option value=\"5\">Team 5</option>\n<option value=\"6\">Team 6</option>\n<option value=\"7\">Team 7</option>\n<option value=\"8\">Team 8</option></select></td></tr>\n"; echo "<tr><td><input type=\"submit\" name=\"submit\" value=\"Get Pairs\"/></td></tr>\n"; echo "</form></table>\n"; } else { $t1 = $_POST['plyr1a']; $t2 = $_POST['plyr1b']; $t3 = $_POST['plyr1c']; $t3 = $_POST['plyr1d']; $t4 = $_POST['plyr1e']; $t5 = $_POST['plyr1f']; $t6 = $_POST['plyr1g']; $t7 = $_POST['plyr1h']; $teama = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamb = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamc = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamd = array('1', '2', '3', '4', '5', '6', '7', '8'); $teame = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamf = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamg = array('1', '2', '3', '4', '5', '6', '7', '8'); $teamh = array('1', '2', '3', '4', '5', '6', '7', '8'); if (!$plyr1a) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1b) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1c) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1d) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1e) { $errors[] = "You did not supply a team member"; if (!$plyr1f) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1g) { $errors[] = "You did not supply a team member"; } else { if (!$plyr1h) { $errors[] = "You did not supply a team member"; } else { switch ($teama) { case '1': echo $_POST['plyr1a']; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamb) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamc) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamd) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teame) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamf) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamg) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; switch ($teamh) { case '1': $written = $plyr1a; break; case '2': $written = $plyr1b; break; case '3': $written = $plyr1c; break; case '4': $written = $plyr1d; break; case '5': $written = $plyr1e; break; case '6': $written = $plyr1f; break; case '7': $written = $plyr1g; break; case '8': $written = $plyr1h; break; default : $written = ""; break; } echo $written; } } } } } } } } } ?><br> Match #1: <?php echo $_POST["teama"]; ?> vs <?php echo $_POST["teamb"]; ?> <br> Match #2: <?php echo $_POST["teamc"]; ?> vs <?php echo $_POST["teamd"]; ?> <br> Match #3: <?php echo $_POST["teame"]; ?> vs <?php echo $_POST["teamf"]; ?> <br> Match #4: <?php echo $_POST["teamg"]; ?> vs <?php echo $_POST["teamh"]; ?> <br> <br> I have a form page (referred to as form.php) which is then processed via a submit button, the script then processes the data from the form.php and if it discovers an error it then sets a variable containing the error message my process page contains Code: [Select] if (empty($b_addr)) { $b_addr_error = "Address is required"; $check_failed = TRUE;} header("Location: form.php"); then my form.php contains Code: [Select] $b_addr_error = safe($_GET['b_addr_error']); if (isset($_POST['$b_addr_error'])) { echo "<div class='errorfont' align='center'>'".$b_addr_error."';</div>"; } but the variables do not get passed back to form.php from the process page, any ideas? Thank you. Hi, Which one is better from performance view (CPU usage and etc)? using too many Variables or a single Associative Array or generally an Array? This one: $ld_linkdump_title = get_option('ld_linkdump_title'); $ld_linkdump_widget_title = get_option('ld_linkdump_widget_title'); $nw_option = get_option('ld_open_nw'); $ld_open_branding = get_option('ld_open_branding'); $ld_stylesheet_option = get_option('ld_stylesheet'); $ld_number_of_links = get_option('ld_number_of_links'); $ld_number_of_links_widget = get_option('ld_number_of_links_widget'); $ld_number_of_rss_links = get_option('ld_number_of_rss_links'); $ld_number_of_links_be = get_option('ld_number_of_links_be'); $ld_repeated_link = get_option('ld_repeated_link'); $ld_linkdump_fd = get_option('ld_linkdump_fd'); $ld_linkdump_rss_desc = get_option('ld_linkdump_rss_desc'); $ld_branding_bg = get_option('ld_branding_bg'); $ld_archive_days = get_option('ld_archive_days'); $ld_archive_pid = get_option('ld_archive_pid'); $ld_show_counter = get_option('ld_show_counter'); $ld_show_description = get_option('ld_show_description'); $ld_show_description_w = get_option('ld_show_description_w'); $ld_send_notification = get_option('ld_send_notification'); $ld_auto_approve = get_option('ld_auto_approve'); $ld_short_url = get_option('ld_short_url'); or this: $options['ld_linkdump_title'] = get_option('ld_linkdump_title'); $options['ld_linkdump_widget_title'] = get_option('ld_linkdump_widget_title'); $options['nw_option'] = get_option('ld_open_nw'); . . . they recently reset my website so my php.ini file has been adjusted. One of my sites is no longer passing a session variable to the next page. I am sure its one of the settings being reset. here is the data from my phpinfo file. Anything that looks off to anyone? session Session Support enabled Registered save handlers files user sqlite Registered serializer handlers php php_binary wddx Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 On On session.bug_compat_warn On On session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_httponly Off Off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 100 100 session.gc_maxlifetime 1440 1440 session.gc_probability 1 1 session.hash_bits_per_character 4 4 session.hash_function 0 0 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path /home/users/web/b535/ipw.plevtech/public_html/cgi-bin/tmp /home/users/web/b535/ipw.plevtech/public_html/cgi-bin/tmp session.serialize_handler php php session.use_cookies On On session.use_only_cookies Off Off session.use_trans_sid 0 0 Hello all, So I've picked up a PHP book in an attempt to learn it. The issue I'm having is preventing me from getting any further. They have me creating a simple order form, but the data is not passing from the HTML page to the PHP Processing file. I know there are other ways of doing this that I'm unaware of, but this code is verbatam to what we are isntructed to type within the book itself. Here is the code orderform.html: Code: [Select] <html> <body> <form action="processorder.php" method="post"> <table border="0"> <tr bgcolor="#cccccc"> <td width="150">Item</td> <td width="15">Quantity</td> </tr> <tr> <td>Tires</td> <td align="center"><input type="text" name="tireqty" size="3" maxlength="3"></td> </tr> <tr> <td>Oil</td> <td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td> </tr> <tr> <td>Spark Plugs</td> <td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"></td> </tr> <tr> <td>How did you find Bob's?</td> <td><select name="find"> <option value = "a">I'm a regular customer</option> <option value = "b">TV advertising</option> <option value = "c">Phone directory</option> <option value = "d">Word of mouth</option> </select> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="Submit Order"></td> </tr> </table> </form> </body> </html> processorder.php: <!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>Bobs Auto Parts - Order Results</title> </head> <body> <h1>Bobs Auto Parts</h1> <h2>Order Results</h2> <?php $tireqty = $_post['tireqty']; $oilqty = $_post['oilqty']; $sparkqty = $_post['sparkqty']; echo "<p>Order Processed at "; echo date('H:i, jS F Y'); echo "</p>"; echo '<p>Your order is as follows: </p>'; echo $tireqty.' tires<br />'; echo $oilqty.' bottles of oil<br />'; echo $sparkqty.' spark plugs<br />'; $totalqty = 0; $totalamount = 0.00; define('TIREPRICE', 100); define('OILPRICE', 10); define('SPARKPRICE', 4); ?> </body> </html> For some reason the values on the processing form dont show up. The only text thats displayed is : Bobs Auto Parts Order Results Order Processed at 17:07, 9th January 2011 Your order is as follows: tires <---- Should be showing the total quantity ordered bottles of oil <---- Should be showing the total quantity ordered spark plugs <---- Should be showing the total quantity ordered Is anyone able to let me know where the error is in this code? The writers website isnt any help.... Regards, sapper6fd hello, what I made is, each user joins in, he enters a recruitment ID of another user who recruited him, so I can calculate the commission of each. and It's working great but now what I want to do, is to make each user take comission of the people he recruited, and the people they recruited and so on here is my code for the first, don't know how to make the second Code: [Select] <?php $result = mysql_query("select * from users where id = '{$_GET['id']}'"); $row = @mysql_fetch_array($result); $rid = $row['id']; $sql = mysql_query("select * from users where recruiteris = $rid"); $num_rows = mysql_num_rows($sql); $var3 = '10'; $commission = $num_rows * $var3; ?> I am trying to take a value that is stored in a db for address and parse it into 4 different variables: $address $city $state $zip when I started the loop and echo'd the results, here is how it comes out: Code: [Select] a:4:{s:14:"street_address";s:20:"811 East Parrish Ave";s:4:"city";s:9:"Owensboro";s:5:"state";s:2:"KY";s:3:"zip";s:5:"42303";} a:4:{s:14:"street_address";b:0;s:4:"city";b:0;s:5:"state";b:0;s:3:"zip";b:0;} a:4:{s:14:"street_address";s:15:"800 Rose Street";s:4:"city";s:9:"Lexington";s:5:"state";s:2:"KY";s:3:"zip";s:5:"40536";} a:4:{s:14:"street_address";s:19:"1300 State Hwy 3298";s:4:"city";s:10:"Olive Hill";s:5:"state";s:2:"KY";s:3:"zip";s:5:"41164";} a:4:{s:14:"street_address";s:22:"1301 North Race Street";s:4:"city";s:7:"Glasgow";s:5:"state";s:2:"KY";s:3:"zip";s:5:"42141";} a:4:{s:14:"street_address";s:23:"200 Abraham Flexner Way";s:4:"city";s:10:"Louisville";s:5:"state";s:2:"KY";s:3:"zip";s:5:"40202";} |