PHP - Display One Thing First Loop Pass And Something Else Second Pass
I'm trying to get a simple table to display and am not sure how to make it happen. Table will have just 2 columns. A TIME and an EVENT. What I want to have happen is for the first row to show the TIME and next to that, the EVENT. If a TIME has more than one event going I want the next row to show an empty first cell and then the second event below the first.
If I set up the loop the only way I know how (so far) it would also output the TIME value again and again as many times as there were events for that same time. For example what I don't want is: 9:15 Sunday School 9:15 Nursery Available What I do want is: 9:15 Sunday School Nursery Available Thanks. Similar TutorialsI work with a large codebase and I have this situation come up fairly often:
the legacy class has large objects such as:
$design->motor->dimensions->a; $design->motor->dimensions->bd; $design->specifications->weight; $design->data->height; //etcWhen I create a new class, that class sometimes operates on the specific data, so say: class MyClass { public function compute($weight, $height, $a) { //stuff } } //and I call this for example as such: (new MyClass())->compute($design->specifications->weight, $design->data->height, $design->motor->dimensions->a);CONS: Potential issue: if design specs change and I need to change things parameters in "compute" function, I need to "re-key" the variables I pass to the function, and adjust things accordinly in MyClass as wel. PROS: only the exact data is being passed, and this data can come from anywhere it is viable, so in effect the function is fairly well separated, I think. Alternative option for me is to pass the entire design object, i.e class MyClass { public function compute(&$design) //can also be done via DI through a setter or constructor. { print $design->specifications->weight; print ($design->data->height + $design->motor->dimensions->a); //stuff } } (new MyClass())->compute($design);PROS: In this case when things change internally in which variables are needed and how things are computed, I only need to change the code in compute function of the class itself. CONS: MyClass now needs to be aware of how $design object is constructed. When it comes to this parameter passing, and Dependency Injection like this in general, does Computer Science advocate a preference on this issue? Do I pass the entire object, or do I pass only the bits and pieces I need? hello how do i pass a foreach loop through "Passing by Reference" say i have a foreach loop in a function like this: Code: [Select] function findText(&$output){ $word = Text::find_all(); foreach ($word as $words){ $output = $words->text; } } then one the page i put Code: [Select] findText($output); echo $output; that will just give me the last word in the database. so how do i get it to echo out the array on the page ? thanks Code: [Select] $col = 0; if ($num_products_count > 0) { while (!$specials_index->EOF) { $list_box_contents[$row][$col] = array('params' =>'<a href="#">' .zen_image(..). '</a>'), $col ++; } } now i want to pass some values<img src="1.jpg">,<img src="1.jpg">,<img src="2.jpg">,<img src="3.jpg">,<img src="4.jpg">,<img src="5.jpg"> to zen_image(..). how should i do? namely, if there are five loops.i want to change zen_image(..) output result to (<img src="1.jpg">,<img src="1.jpg">,<img src="2.jpg">,<img src="3.jpg">,<img src="4.jpg">,<img src="5.jpg">) this is my nav menu code Code: [Select] <ul> <li><a href='fountains_page.php?id=all'>all fountains</a></li> <li><a href='fountains_page.php?id=garden'>garden fountains</a></li> <li><a href='fountains_page.php?id=wall'>wall fountains</a></li> </ul> this is my script Code: [Select] require('dbconnect.php'); $id = $_GET['id']; if($id = all){ $records = "SELECT * FROM (fountains)"; }else{ if ($id = garden){ $records = "SELECT * FROM (fountains) WHERE wall='no'"; }else{ if($id = wall){ $records = "SELECT * FROM (fountains) WHERE wall='yes'"; } } } $query_records = mysql_query($records); $num_records = mysql_num_rows($query_records); if ($num_records == 0) { echo "The menu is closed for now."; } else{ $i=1; } echo 'We have'.' '.$num_records.' '.'fountains for your consideration<br />Please visit our store to view hundreds of styles.<br />'; echo $id; $errors = array(); // initialize error array Here is the link http://www.mywebsitepaid.com/stonemans/fountains_page.php I can't get the 'id' to pass. What am I doing wrong? I did another site fine, but here I messed something up. I have researched all over forums from past day. Not getting correct solution. I have 2 textboxes and a button. First box is to enter value and i will click button, i need to get the value.
Here is the code, that works without input box 1
In this code i want to modify my web address, at the end after ky= i want add my first textbox value, then click event and output in second textbox, let me know where i messed.
<script type="text/javascript"> function Assign() { <?php $html = file_get_contents("http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=79401:006:0812" ); preg_match_all('(<li.*?>.*?</li>)', $html, $matches); $one=$matches[0][0]; ?> document.getElementById("OutputField").value = "<?=$one?>"; } </script> <input id="InputField" type="text" style="width:200px"/> <input type="submit" value="Assign Value" onclick="Assign()"/> <input id="OutputField" type="text" style="width:200px"/> Hello there,
I have 2 questions:
1) Look he http://www.hellastra...ooking/taxi.php
I have a form and i want to pass values from URL to fields.
So, for example to pass a value to Prefered driver ID field you write this:
http://www.hellastra...?drivercode-123 and the value 123 is passed to that field. I did this with this code:
<?php $sDriverCode = $_REQUEST['drivercode']; ?> <input style="width:100px;" name="drivercode" id="drivercode" value="<?=$sDriverCode?>" data-mini="true" />At the same form i have some radio-type fields. Its the one you see at Type of Vehicle (Standard, Premium etc). When i try to do the same, i cannot get this to work. What i am trying to do is this: i hav this url n whenever i click on this url i get som mssg send on my mobile i hav a form whose code is Code: [Select] <form action="formprocess.php method="post"> telephone<input type="text name="telephone> <input type="submit" name="submit"> </form> i want to send telephone as parameter to this url so whenever user enters his telephone he gets d mssg after clicking on submit.....but i hav no idea how to do tht...help me somone plssssssss http://www.abc.in/smsapi/sendsms.php?sendto=9987234123&msg=your so I need some help passing these variable from this page to final.php. how do I pass these arrays? I know if it were singled....not arrayed, I could use hidden fields in a form and echo them out....but these are multiples....not singled. The form way is prefered.....but it doesn't have to be. I just need these passed to the page where I am going to process them. I am not good at working with arrays. Thanks in advance Code: [Select] <?php include_once("connect.php"); session_start(); foreach($_POST["product"] AS $key => $val) { $product = $val; $month = $_POST['month'][$key]; $day = $_POST['day'][$key]; $year = $_POST['year'][$key]; $date = $_POST['date'][$key]; $price = $_POST['price'][$key]; $qty = $_POST['qty'][$key]; $id = $_POST['id'][$key]; $total = $_POST['total'][$key]; $academy = $_POST['academy'][$key]; $priceunit = $price * $qty; } ?> Hi guys, I need your help, I have got a problem with the if statement. When I don't insert the pass function in the url like this: Code: [Select] http://www.mysite.com/myscript.php?image=myimagelocation&strings=mystrings&user=test I will get this on my php page: Code: [Select] PASSWORD are missing Code: [Select] <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'mydbusername'); define('DB_PASSWORD', 'mydbpass'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $image = clean($_GET['image']); $strings = clean($_GET['strings']); $username = clean($_GET['user']); $pass = clean($_GET['pass']); if($username == '' && $pass) { $errmsg_arr[] = 'username are missing'; $errflag = true; }elseif($username && $pass =='') { $errmsg_arr[] = 'PASSWORD are missing'; $errflag = true; } if($username == '' && $pass == '') { $errmsg_arr[] = 'username or password missing'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['image'])) { $insert[] = 'image = \'' . clean($_GET['image']) . '\''; } if(isset($_GET['strings'])) { $insert[] = 'strings = \'' . clean($_GET['strings']) . '\''; } if(isset($_GET['user'])) { $insert[] = 'user = \'' . clean($_GET['user']) .'\''; } if(isset($_GET['pass'])) { $insert[] = 'pass = \'' . clean($_GET['pass']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); $required_fields = array('image', 'strings', 'user'); if($image && $strings && $username) { echo "working 1"; } elseif($username && $pass) { echo "working 2"; } } } ?> Do anyone know how to fix this? hello how do i pass a value from 1 function to another i want to use this part Code: [Select] //send the list order to the navigation or list page $PHL = PhLists::by_listNo($PHGlno); foreach ($PHL as $PHLs){ $PHLlno = $PHLs->phList_No; $PHLorb = $PHLs->orderBy; $PHLord = $PHLs->orderDir; } from this very long function. Code: [Select] function include_placeHolders($position, $phNo, $pageID){ $langBS = basicSettings::find_by_id(1); $langID = $langBS->language_id; //FIND PLACEHOLDER BY ID $PH = Placeholders::find_by_pageID($pageID); foreach ($PH as $PHs){ $PHpos = $PHs->position; $PHnum = $PHs->phNumber; $PHgNo = $PHs->phGroup_No; $PHgFx = $PHs->PHGfx_id; $PHgThm = $PHs->PHGtheme_id; if($phNo == $PHnum && $position == $PHpos){ //FIND ELEMENT THEMES echo '<style type="text/css" media="screen">'; include(PAGES.DS."phGroups".DS."theme{$PHgThm}".DS."css".DS."styles.css"); echo '</style>'; echo'<div id="PHgroup">'; //FIND GROUPS BY phGroupNo $PHGodr = PhGroups::find_order($PHgNo); foreach ($PHGodr as $PHGodrs){ $PHGob = $PHGodrs->orderBy; $PHGod = $PHGodrs->orderDir; } //FIND PHGROUPS BY BY GROUPno & ORDER $PHG = PhGroups::find_by_order($PHgNo, $PHGob, $PHGod); foreach ($PHG as $PHGs){ $PHGid = $PHGs->id; $PHGname = $PHGs->name; $PHGgno = $PHGs->phGroup_No; $PHGlno = $PHGs->list_No; $PHGce = $PHGs->contElements_id; $PHGpl = $PHGs->pageLink_id; $extLink = $PHGs->extLink_id; $PHfx = $PHGs->PHfx_id; $PHthm = $PHGs->PHtheme_id; //send the list order to the navigation or list page $PHL = PhLists::by_listNo($PHGlno); foreach ($PHL as $PHLs){ $PHLlno = $PHLs->phList_No; $PHLorb = $PHLs->orderBy; $PHLord = $PHLs->orderDir; } //FIND EXTERNAL LINK $PHGeL = ExtLinks::find_link($extLink); foreach($PHGeL as $PHGeLs){ $PHGurl = $PHGeLs->url; $PHGtarget = $PHGeLs->target; } //FIND ELEMENTS $CE = ContElements::find_by_phg($PHGce); foreach ($CE as $CEs){ $CEeName = $CEs->name; $CEetype = $CEs->elementTypes_id; $CEefx = $CEs->elFx_id; $CEethm = $CEs->elTheme_id; //FIND ELEMENT TYPE NAME $CEt = ElementsTypes::find_Etype($CEetype); foreach ($CEt as $CEts){ $CEtName = $CEts->name; //FIND PLACEHOLDER THEMES echo '<style type="text/css" media="screen">'; include(PAGES.DS."placeHolders".DS."theme{$PHthm}".DS."css".DS."styles.css"); echo '</style>'; //FIND ELEMENT THEMES echo '<style type="text/css" media="screen">'; include(ELEMENTS.DS."{$CEtName}".DS."themes".DS."theme{$CEethm}".DS."css".DS."styles.css"); echo '</style>'; //FIND INTERNAL OR EXTERNAL LINK $pageLNK = (empty($PHGpl)) ? '' : '<a href="index.php?pageID='.$PHGpl.'">'; $extLNK = (empty($extLink)) ? '' : '<a href="'.$PHGurl.'" target="'.$PHGtarget.'">'; $ENDpageLNK = (empty($PHGpl)) ? '' : '</a>'; $ENDextLNK = (empty($extLink)) ? '' : '</a>'; echo $pageLNK; echo $extLNK; echo'<div id="ph"> <div id="PHelement">'; include(ELEMENTS.DS."{$CEtName}".DS."{$CEeName}.php"); echo'</div></div>'; echo $ENDpageLNK; echo $ENDextLNK; } } } echo'</div>'; } } } i want the next long function to use these values Quote $PHLlno = $PHLs->phList_No; $PHLorb = $PHLs->orderBy; $PHLord = $PHLs->orderDir; this is where i want to use them in the next function Quote $nH = PhLists::navOrder($PHLlno, $PHLorb, $PHLord); Code: [Select] function nav(&$navLink){ $nH = PhLists::navOrder($PHLlno, $PHLorb, $PHLord); foreach ($nH as $nHs){ $nav_typ = $nHs->type; $nav_lvl = $nHs->levels; $nav_pLnk = $nHs->pageLink_id; $nav_eLnk = $nHs->extLink_id; $nav_tType = $nHs->titleType; $nav_ctBid = $nHs->custTxtBridge_id; //INTERNAL LINKS if($nav_typ == "Internal"){ //USE SET TITLE if($nav_tType == "SetTitle"){ $navPage = Pages::findNav($nav_pLnk); foreach ($navPage as $navPages){ $NPbid = $navPages->PCbridge_id; } $STBhead = PCbridge::find_setTitle($NPbid, $langID); foreach ($STBhead as $STBheads){ $text = $STBheads->pageContent_id; } $navText = PageContent::find_text($text); foreach ($navText as $navTexts){ $navLink = $navTexts->title; } //USE CUSTOM TITLE }else if($nav_tType == "Custom"){ $CTBhead = PCbridge::find_customTitle($nav_ctBid, $langID); foreach ($CTBhead as $CTBheads){ $text = $CTBheads->pageContent_id; } $navText = PageContent::find_text($text); foreach ($navText as $navTexts){ $navLink = $navTexts->title; } } } //EXTERNAL LINKS if($nav_typ == "External"){ //USE SET TITLE if($nav_tType == "SetTitle"){ $navExt = ExtLinks::findNav($nav_eLnk); foreach ($navExt as $navExts){ $navLink = $navExts->name; $PHGurl = $navExts->url; $PHGtarget = $navExts->target; } //USE CUSTOM TITLE }else if($nav_tType == "Custom"){ $navExt = ExtLinks::findNav($nav_eLnk); foreach ($navExt as $navExts){ $PHGurl = $navExts->url; $PHGtarget = $navExts->target; } $CTBhead = PCbridge::find_customTitle($nav_ctBid, $langID); foreach ($CTBhead as $CTBheads){ $text = $CTBheads->pageContent_id; } $navText = PageContent::find_text($text); foreach ($navText as $navTexts){ $navLink = $navTexts->title; } } } //NO LINK if($nav_typ == "Non"){ //USE CUSTOM TITLE if($nav_tType == "Custom"){ $CTBhead = PCbridge::find_customTitle($nav_ctBid, $langID); foreach ($CTBhead as $CTBheads){ $text = $CTBheads->pageContent_id; } $navText = PageContent::find_text($text); foreach ($navText as $navTexts){ $navLink = $navTexts->title; } } } } } thanks Hi ! I need to pass a lot of variables using GET, and many of them are related, so I was thinking in two options: 1) Pass them as array: Code: [Select] example.php?categories[]=cat1&categories[]=cat2 2) Pass them in a single parameter, and split it in PHP (a custom and simpler serializer) Code: [Select] example.php?categories=cat1|cat2 What do you think is better? (or maybe there is a 3rd option...) The second method seems more readable and short, the first easier to construct and maybe faster because we don't need to "unserialize". But I'm looking for better reasons. I'm thinking in a possible advantage of the first method over the second for SEO, because if Google is smart enough to understand that categories[] are all the same, then can understand that: Code: [Select] example.php?categories[]=cat1&categories[]=cat2is equal to: Code: [Select] example.php?categories[]=cat2&categories[]=cat1I think that is more difficult for Google to understand that with: Code: [Select] example.php?categories=cat1|cat2and Code: [Select] example.php?categories=cat2|cat1 Regards!! Enrique. how can i do this ? i have a number of links , when i click one a pop up is displayed, i need to run a php script depending upon which link is clicked.
Or can i run a javascript function once a query string is passed in the url
Please advice.
Edited by chauhanRohit, 12 July 2014 - 04:10 AM. Hi guys, I have got a problem with the if variable statements. When I insert the text of the image location, the name of the strings and when I did not insert the username, all I get this: Code: [Select] image, strings or username are missing Username or password are missing. It should not display with the "Username or password are missing.", only the "image, strings or username are missing". The area of the code i am working on: if($image == '' && $strings == '' && $username == '') { $errmsg_arr[] = 'image, strings or username are missing'; $errflag = true; } elseif($username == '' && $password == ''){ $errmsg_arr[] = 'Username or password are missing.'; $errflag = true; } <?php session_start(); define('DB_HOST', 'localhost'); define('DB_USER', 'myusername'); define('DB_PASSWORD', 'mypassword'); define('DB_DATABASE', 'mydbname'); $errmsg_arr = array(); $errflag = false; $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } function clean($var){ return mysql_real_escape_string(strip_tags($var)); } $image = clean($_GET['image']); $strings = clean($_GET['strings']); $username = clean($_GET['user']); $pass = clean($_GET['pass']); $delete = clean($_GET['delete']); if($image == '' && $strings == '' && $username == '') { $errmsg_arr[] = 'image, strings or username are missing'; $errflag = true; } elseif($username == '' && $password == ''){ $errmsg_arr[] = 'Username or password are missing.'; $errflag = true; } if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; echo implode('<br />',$errmsg_arr); } else { $insert = array(); if(isset($_GET['image'])) { $insert[] = 'image = \'' . clean($_GET['image']) . '\''; } if(isset($_GET['strings'])) { $insert[] = 'strings = \'' . clean($_GET['strings']) . '\''; } if(isset($_GET['user'])) { $insert[] = 'username = \'' . clean($_GET['user']) .'\''; } if(isset($_GET['pass'])) { $insert[] = 'pass = \'' . clean($_GET['pass']) . '\''; } if(isset($_GET['delete'])) { $insert[] = 'delete = \'' . clean($_GET['delete']) . '\''; } if (count($insert)>0) { $names = implode(',',$insert); if(isset($image) && ($strings) && ($username)) { echo "test"; } elseif($username && $delete == 'all') { if ($delete != NULL) { mysql_query("DELETE FROM user_list WHERE username='$username'"); $deleted = mysql_affected_rows(); if($deleted > 0) { echo("The data are now deleted"); } else { echo("The user's data is empty"); } }else{ echo("failed"); } mysql_close($link); } } } ?> Do anyone know how i can get pass on those methods if I enter the images, the name of the strings and the username or the or the username with the password? Cant seem to figure this one out for a chained script. In the code below I need to take the value of $drop_var from function drop_1() and send it to function drop_2() So I can add it to the Where clause to limit the results of the third box a little more. But I cannot get the value to pass to the function. Any help appreciated. func.php <?php //************************************** // Page load dropdown results // //************************************** function getTierOne() { $result = mysql_query("SELECT DISTINCT branch FROM rank") or die(mysql_error()); while($tier = mysql_fetch_array( $result )) { echo '<option value="'.$tier['branch'].'">'.$tier['branch'].'</option>'; } } //************************************** // First selection results // //************************************** if($_GET['func'] == "drop_1" && isset($_GET['func'])) { drop_1($_GET['drop_var']); } function drop_1($drop_var) { include_once('db.php'); $result = mysql_query("SELECT DISTINCT type FROM rank WHERE branch='$drop_var'") or die(mysql_error()); echo '<select name="drop_2" id="drop_2"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_2 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_2['type'].'">'.$drop_2['type'].'</option>'; } echo '</select>'; echo "<script type=\"text/javascript\"> $('#wait_2').hide(); $('#drop_2').change(function(){ $('#wait_2').show(); $('#result_2').hide(); $.get(\"func.php\", { func: \"drop_2\", drop_var2: $('#drop_2').val() }, function(response){ $('#result_2').fadeOut(); setTimeout(\"finishAjax_tier_three('result_2', '\"+escape(response)+\"')\", 400); }); return false; }); </script>"; } //************************************** // Second selection results // //************************************** if($_GET['func'] == "drop_2" && isset($_GET['func'])) { drop_2($_GET['drop_var2']); } function drop_2($drop_var2) { echo "<br>($drop_var)<br>"; include_once('db.php'); $result = mysql_query("SELECT * FROM rank WHERE type='$drop_var2'") or die(mysql_error()); echo '<select name="drop_3" id="drop_3"> <option value=" " disabled="disabled" selected="selected">Choose one</option>'; while($drop_3 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_3['grade'].'">'.$drop_3['grade'].'</option>'; } echo '</select>'; echo '<input type="submit" name="submit" value="Submit" />'; } ?> index.php <?php include('db.php'); include('func.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>Chained Select Boxes using PHP, MySQL and jQuery</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { $('#wait_1').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } function finishAjax_tier_three(id, response) { $('#wait_2').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } </script> </head> <body> <p> <form action="" method="post"> <select name="drop_1" id="drop_1"> <option value="" selected="selected" disabled="disabled">Select a Category</option> <?php getTierOne(); ?> </select> <span id="wait_1" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_1" style="display: none;"></span> <span id="wait_2" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_2" style="display: none;"></span> </form> </p> <p> <?php if(isset($_POST['submit'])){ $drop = $_POST['drop_1']; $drop_2 = $_POST['drop_2']; $drop_3 = $_POST['drop_3']; echo "You selected a "; echo $drop_3." ".$drop." ".$drop_2; } ?> </body> </html> I'd like to pass a value from a URL to an iframe. This would look as follows: URL: http://www.mysite.com?www.mysite2.com The value (www.mysite2.com) will be an actual web address which should then be inserted into an iframe on www.mysite.com via php. Since I know little to no php, I don't know how the URL has to be structured and what php coding I need to use to include the web address in the iframe. Any suggestions are highly appreciated Trying to pass VARS $URL1 and $type to header location.Heres the code. Code: [Select] $URL1 = $_POST['url']; $type = $_POST['type_request']; session_start(); $string = strtoupper($_SESSION['string']); $userstring = strtoupper($_POST['userstring']); session_destroy(); if (($string == $userstring) && (strlen($string) > 4)) { header("Location: $success"); exit(); The VARS come from a FORM and then go to this script for checkind data. I need to have them continue to the next page. Hello
I'm using a form to collect user data (is a Cognito form) it is displayed on vacation rental properties pages, so it collects user´s email, in date, out date, etc. in the cognito form I have one text hidden field called REF, I wonder how to do in order to use the same form and be able to identify where the info comes from. I thougt that if I could put the page url into the REF variable, the problem would be solved, but I'm not sure if that is possible and how to do it. It is? If not: is it possible to handle that ? i knw dis mst a simple question but how to pass variable to other page for eg i hav created a page where user submits username n telephone then via sms some random number goes to user mobile ...i want this random number variable in other page dis is my code for startreg.php <form action="startregprocess.php" method="post"> username:<input type="text" name="username"> telephone<input type="text" name="telephone" <input type="submit" name="submit"> </form> <?php srand ((double) microtime( )*1000000); $random_number = rand( ); echo $random_number; ?> i want tht $random_number in other page called startregprocess.php Can someone explain to me how this is done? You guys are great, thanks again for the help last week. Now I almost got this working but a small hiccup. here is my code: Code: [Select] <?php include("config.php"); $my_t=getdate(date("U")); $my_t1=$my_t[weekday]; $result = mysql_query("SELECT * FROM tourney where day_of_week = '$my_t1'") or die(mysql_error()); if ($result == '') echo "<br>Empty Set\n"; print_r ($my_t1); This prints correctly Code: [Select] while ($result = mysql_fetch_array($result,MYSQL_ASSOC)) { This is my error. "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web017/b172/ipg.dswdesignsnet/pp4c/charity1.php on line 8" Code: [Select] print "<b>Starting Time: <br></b>".$row{'start_time'}."<br><b>Tournament: </b><br>".$row{'tourney'}."<br><b>Buy-in: <br>".$row{'buy_in'}."<br><b>Starting Chips: <br>".$row{'start_chips'}."</font><p>"; This prints headers correctly, but no variables. Code: [Select] } mysql_close($dbh); ?> What did I forget to do or what did I do wrong. I'm still learning mysql and php. |