PHP - Problem With Variables
How would I output the value of a variable, getting the name from the value of another variable? For example:
$var1 = 'var2'; $var2 = 'output'; I want it to return 'output', which I'd imagine would work through entering something along lines of $$var1; Does anyone know what I mean? Similar TutorialsI am having probelm in saving Session variables ALthough I'm writing session_start(); in the header of my php script and saving the values of Session array in the next page. It does not print the values or show right results. Code: [Select] session_start(); require_once ("functions.php"); $token=$_GET['t']; if(!isset($token)){ $name = stripslashes($_POST['username']); $email = stripslashes($_POST['email']); check_validate_input($name, $email); } if($token=='register') { show_registration_form(); } $my_model = new model(); $arr_info = $my_model->check_members($name,$email); if (($arr_info==NULL)&&($token!='register')) { echo '<p> Hello Guest</p><br />'; show_mailing_form(); } else if (($arr_info['role']=='user')||($arr_info['role'] == 'admin')) { $_SESSION['userId']=$arr_info['id']; $_SESSION['user_role']=$arr_info['role']; $_SESSION['user_name']=$arr_info['name']; print_r ($_SESSION);} here it does not print session array. $errors=0; //NEW USER NAME HAS BEEN SUBMITTED, CHECK IT OUT AND THEN ADD IF OKAY $newuser=$_REQUEST['newuser']; function TryAgain(){ global $errors; $errors++; echo '<br/><br/>Please try again <a href="index.php?locate=admin&sub=add_admin">here</a>'; echo "<br/>errors=[$errors]"; } echo "<br/>Trying to add user: $newuser<br/><br/>"; if ($newuser){ }else{ // field was left blank, report this to user and give them option to try again echo '<br/>Field was left empty, you must pick a username.';TryAgain(); } if (strlen($newuser)<5){echo 'Username should be at least 5 characters.';TryAgain();} if (!$errors){echo "continue to SQL [errors=$errors]";} what is wrong with this code? For some reason if I increment $errors with $errors++ within the function it doesn't increment outside the function's scope. even though I declare it as a global at the start of the function. I know I'm doing something stupid here but can somebody please tell me what it is? Thanks what is the problem in this code <div id="product"> <a class='inline' href="?prod=<?php echo $row['id'];?>#<?php echo $row['id']; ?>" > ..... </a> </div> <div style='display:none'> <div id='<?php echo $row['id'];?>'> .... </div> </div> $prod=$_GET['prod']; echo "the value of prod".$prod; $_SESSION['cart']=$prod; <script> $(document).ready(function(){ //Examples of how to assign the ColorBox event to elements $(".inline").colorbox({inline:true}); }); </script> Hi I have an infuriating problem which is stalling me with two large projects for a well known NGO right now. I am using mysqli and bound variables where the number of variables to bind is dependent on user input. I have a version of the code below working in php 5.2 but as of php 5.3 this method is no longer valid, specifically due to a change in the behavior of call_user_func_array with bound variables as arrays. I have read about this problem eslewhere but cannot get any of the workarounds to work with my example. Any help would be greatly appreciated. Code: [Select] # $parts is an array with variable number of values # $type is an array with variable number of values # $params is an array with variable number of values $query = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT taxon.TaxonID, FROM taxon WHERE . join('', $parts) . " ORDER BY taxon.TaxonID"; # Prepare stmt if ($stmt = $mysqli->prepare($query)) { call_user_func_array (array($stmt, 'bind_param'),array_merge(array(join('', $type)), $params)); # execute $stmt->execute(); # bug info echo $stmt->errno, ':', $stmt->error; #store result $stmt->store_result(); # bind results $stmt->bind_result($ID); # fetch values while ($stmt->fetch()) { # results code goes here! } # free memory $stmt->free_result(); # close statement $stmt->close(); } This code was given to me by mjdamato to help display a student and the course that student has take and within that the modules in the course and the sessions in course including module mark and grade and student's session marks and grades. I am very weak on php code as I have only done it once and that was following a php workbook 2 years ago. I am more of a database specialist. Below is the code given to me and you can also download the code from the attachment: Code: [Select] <?php function outputModule($moduleID, $moduleName, $sessionData) { if(!count($sessionData)) { return false; } $markTotal = 0; $markGrade = 0; $weightSession = 0; $grade = ""; $sessionsHTML = ""; foreach($sessionData as $session) { $sessionsHTML .= "<p><strong>Session:</strong> {$session['SessionId']} <br><strong>Session Mark:</strong> {$session['Mark']}</strong> <br><strong>Session Weight Contribution</strong> {$session['SessionWeight']}%</p>\n"; $markTotal += round($session['Mark'] / 100 * $session['SessionWeight']); $weightSession += ($session['SessionWeight']); $markGrade = round($markTotal / $weightSession * 100); if ($markGrade >= 70){ $grade = "A";} else if ($markGrade >= 60 && $markGrade <= 69){ $grade = "B";} else if ($markGrade >= 50 && $markGrade <= 59){ $grade = "C";} else if ($markGrade >= 40 && $markGrade <= 49){ $grade = "D";} else if ($markGrade >= 30 && $markGrade <= 39){ $grade = "E";} else if ($markGrade >= 0 && $markGrade <= 29){ $grade = "F";} } $moduleHTML = "<p><br><strong>Module:</strong> {$moduleID} - {$moduleName} <br><strong>Module Mark:</strong> {$markTotal} <br><strong>Mark Percentage:</strong> {$markGrade} <br><strong>Grade:</strong> {$grade} </p>\n"; return $moduleHTML . $sessionsHTML; } $output = ""; $studentId = false; $courseId = false; $moduleId = false; while ($row = mysql_fetch_array($result)) { if($studentId != $row['StudentUsername']) { //Student has changed $studentId = $row['StudentUsername']; $output .= "<p><strong>Student:</strong> {$row['StudentForename']} {$row['StudentSurname']} ({$row['StudentUsername']})\n"; } if($courseId != $row['CourseId']) { //Course has changed $courseId = $row['CourseId']; $output .= "<br><strong>Course:</strong> {$row['CourseId']} - {$row['CourseName']} <strong>Course Mark</strong> <strong>Grade</strong> <br><strong>Year:</strong> {$row['Year']}</p>\n"; } if($moduleId != $row['ModuleId']) { //Module has changed if(isset($sessionsAry)) //Don't run function for first record { //Get output for last module and sessions $output .= outputModule($moduleId, $moduleName, $sessionsAry); } //Reset sessions data array and Set values for new module $sessionsAry = array(); $moduleId = $row['ModuleId']; $moduleName = $row['ModuleName']; } //Add session data to array for current module $sessionsAry[] = array('SessionId'=>$row['SessionId'], 'Mark'=>$row['Mark'], 'SessionWeight'=>$row['SessionWeight']); } //Get output for last module $output .= outputModule($moduleId, $moduleName, $sessionsAry); //Display the output echo $output; } } ?> Below the what this code outputs: Student: Mayur Patel (u0867587) Course: INFO101 - Bsc Information Communication Technology Course Mark Year: 3 Module: CHI2550 - Modern Database Applications Module Mark: 41 Mark Percentage: 68 Grade: B Session: AAB Session Mark: 72 Session Weight Contribution 20% Session: AAE Session Mark: 67 Session Weight Contribution 40% Module: CHI2513 - Systems Strategy Module Mark: 31 Mark Percentage: 62 Grade: B Session: AAD Session Mark: 61 Session Weight Contribution 50% If you look above it shows that there is nothing in the Course Mark: section, what Course Mark is suppose to do is total up all the module mark percentages and then divide it by the number of modules. So the calculation will be adding up all the Code: [Select] $markGrade and dividing it by count Code: [Select] $ModuleID. In examle above it will be 68 (mark percentage for 1st module) + 62 (mark percentage for 2nd module) / 2 (number of modules in the course). So the Course Mark should equal 65. The problem is that all of the calculations are in the foreach loop but where the course details and where the course marks are going to be placed are in the while loop. So the problem is that if the total Course Mark (lets say we call in $totalCourse) is displayed in the while loop it will provide an undifined index as the calculation will be placed with the other calculations in the foreach loop which is outside the while loop, if I do the calculation with in the while loop, it will only choose the 1st module mark percentage and divdie it by the first module only, this is obviously incorrect as it sohuld try and do this for all modules hence why my calculations are in the foreach loop which does this. So how will change the code so that the course details can go from the while loop and be placed in the foreach loop so then I can include the calculation in the foreach loop. Thank You and hopefully you understand it, just read it very carefully to understand it, it is very simple what I want to achieve but I do not know how to do it. [attachment deleted by admin] Hello I first should say that I am a beginner. And actully friend was helping me with this but can't really contact him right now so I have to ask here. I have a php file where I have birthdate dropdown menu for month, day and a year and JS that just has all of the details about those 3 "variables" but the problem I am having is that this is inside submit form and whenever I or someone else submits this form and doesn't put any birthdate inside it doesn't show anything like "Please select your birthdate or something like that." and I honestly tried pretty much everything now but can' t get the answer on how to do that. Please help me. :( As the topic sais i have a problem trying to send variables to a javascript popup window, i think the problem is on line 38. I would very much appreciate some help Code: [Select] <html> <head> <script type="text/javascript"> function newPopup(url) { popupWindow = window.open(url,'popUpWindow','height=700,width=400,left=10,top=10,resizable=no,scrollbars=no,toolbar=yes,menubar=no,location=no,directories=no,status=yes') } </script> </head> <?php error_reporting(E_ALL); require_once 'GameQ.php'; $servers = array( 'server 1' => array('cs', 'd2o.warzone.nu', '27015'), 'server 2' => array('cs', 'd2o.warzone.nu', '27017'), 'server 3' => array('cs', 'wc3.warzone.nu', '27017'), 'server 4' => array('cs', 'aim.warzone.nu', '27015'), 'server 5' => array('cs', '83.255.249.204', '27025'), 'server 6' => array('tf2', 'tf2.warzone.nu', '27015'), 'server 7' => array('tf2', '83.255.249.200', '27015'), 'server 9' => array('cssource', 'css.warzone.nu', '27015'), 'server 10' => array('cssource', 'css.warzone.nu', '27017') ); $gq = new GameQ(); $gq->addServers($servers); $gq->setOption('timeout', 200); $gq->setFilter('normalise'); $gq->setFilter('sortplayers', 'gq_ping'); $results = $gq->requestData(); echo "<a href='steam://connect/d2o.warzone.nu:27015'>" . $results["server 1"]['gq_hostname'] . "</a><p>"; echo $results["server 1"]['gq_mapname'] . "<br>"; echo $results["server 1"]['gq_numplayers'] . "/" . $results["server 1"]['gq_maxplayers']; ?> // I think the problem is the line below this one <a href='JavaScript:newPopup("players.php?address=<?php echo="$results['server 1']['gq_address']"; ?>&port=<?php echo="$results['server 1']['gq_port']"; ?>");'> players online </a>"; <?php echo "<p><p>"; echo "<a href='steam://connect/d2o.warzone.nu:27017'>" . $results["server 2"]['gq_hostname'] . "</a><p>"; echo $results["server 2"]['gq_mapname'] . "<br>"; echo $results["server 2"]['gq_numplayers'] . "/" . $results["server 2"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/wc3.warzone.nu:27017'>" . $results["server 3"]['gq_hostname'] . "</a><p>"; echo $results["server 3"]['gq_mapname'] . "<br>"; echo $results["server 3"]['gq_numplayers'] . "/" . $results["server 3"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/aim.warzone.nu:27015'>" . $results["server 4"]['gq_hostname'] . "</a><p>"; echo $results["server 4"]['gq_mapname'] . "<br>"; echo $results["server 4"]['gq_numplayers'] . "/" . $results["server 4"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/83.255.249.204:27025'>" . $results["server 5"]['gq_hostname'] . "</a><p>"; echo $results["server 5"]['gq_mapname'] . "<br>"; echo $results["server 5"]['gq_numplayers'] . "/" . $results["server 5"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/tf2.warzone.nu:27015'>" . $results["server 6"]['gq_hostname'] . "</a><p>"; echo $results["server 6"]['gq_mapname'] . "<br>"; echo $results["server 6"]['gq_numplayers'] . "/" . $results["server 6"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/83.255.249.200:27015'>" . $results["server 7"]['gq_hostname'] . "</a><p>"; echo $results["server 7"]['gq_mapname'] . "<br>"; echo $results["server 7"]['gq_numplayers'] . "/" . $results["server 7"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/tf2.warzone.nu:27015'>" . $results["server 8"]['gq_hostname'] . "</a><p>"; echo $results["server 8"]['gq_mapname'] . "<br>"; echo $results["server 8"]['gq_numplayers'] . "/" . $results["server 8"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/css.warzone.nu:27015'>" . $results["server 9"]['gq_hostname'] . "</a><p>"; echo $results["server 9"]['gq_mapname'] . "<br>"; echo $results["server 9"]['gq_numplayers'] . "/" . $results["server 9"]['gq_maxplayers'] . " players online <p>"; echo "<p><p>"; echo "<a href='steam://connect/css.warzone.nu:27017'>" . $results["server 10"]['gq_hostname'] . "</a><p>"; echo $results["server 10"]['gq_mapname'] . "<br>"; echo $results["server 10"]['gq_numplayers'] . "/" . $results["server 10"]['gq_maxplayers'] . " players online <p>"; ?> </html> This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=315683.0 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()); ?> 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 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'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
Hello, Is it possible to use variables that are declared outside or plainly within a class, and if its possible, how? thanks in advance 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 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? What I would like to find out is how I can echo out all the variables that are in use in the visitors visit. And have these echoed on the page. (for error checking purposes) some of my variables i.e. $username or $email and a few others are being cleared of its content and I can not find any problems searching all the files for the variable name and checking the lines but think that some other variable is in turn causing theproblems. so wanting to find a way to place an echo line that shows all the variables and then have the next line exit; and just move these two new lines around my scripts to find out where the problems might be. |