Assigning Values With Other Values
Say one has an array like such:
array("lang=english", "nomusic=true", "name=Fred", "menu=false");
Is there a function in which I input the array and it makes all the things into variables with the other things as the content like:
$lang="english";
$nomusic="true";
$name="fred";
$menu="false";
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Assigning Values To The Variables
Let us take for example. The variable $a contains 07,08,09. How can we make that 7,8,9. If $a=07 or $a=08 or $a=09 how can we make it to $a=7, $a=8, $a=9
Assigning Values To Arrays
I am performing a MySQL SELECT (which returns multiple rows) to $result and then extracting the results with mysql_fetch_array($result). I then want to build a number of arrays using the fields of each row. Here is the relevant code: <snip> $result = $i = 1; while ($row = mysql_fetch_array($result)) { extract($row); /* break the row into its fields */ $array0[$i] = $row[0]; /* 1st Field of Row */ $array1[$i] = $row[1]; /* 2nd Field of Row */ $array2[$i] = $row[2]; /* 3rd Field of Row */ $i++; } </snip>
Assigning Values Within Href
I'm having a hard time finding information (probably due to how I'm phrasing my searches) on how to assign a variable to an href. The big picture is I have a bunch of photos I'm trying to put on my website. I have an equally large bunch of thumbnails with links, all to the same page (pictures.php) that has a snippet of php (seen below). In my links I am attempting to assign a value to a variable that corresponds with a picture. Code:
Using Quoation Marks When Assigning Values In Php.ini
php.ini which was created on my local w2k during installation has some no-number and no-logic values assigned using quoation marks whereas the other with no quoation marks: upload_tmp_dir = "C:php4uploads" allow_url_fopen = On java.class.path = .php_java.jar And I can not figure out any pattern
Assigning Values Back To Drop Down Box
I have several drop down boxes that I'd like to repopulate with the value the user selected -- after the form posts by calling itself -- these fields are blanked out. I am having difficulty getting the drop downs to repopulate with the values the user's selected. If any of you have implemented this before, how have you done this and what is the syntax?
[SimpleXML] Assigning Values To Elements Found With XPath
I want to find all elements named "field" in an XML doc and assign a new value to each one. I'd tried something like this: foreach ($xml->xpath('//field') as &$field) $field = $value; But that doesn't work, because (I think) XPath returns a temporary array, not a reference to an actual element. ("PHP Fatal error: Cannot create references to elements of a temporary array expression") Is there a way to assign values to elements located with XPath, or do I just have to iterate over the whole document?
Adding New Values To An Array That Already Contains Values..
is it possible to append new values to an array that already has values in it?? say, i have my existing array; existing array; $array = array([66314] => 66314 , [66315] => 66315) ; then , when i check my checkbox on my next page, the ids should be appended to the $array: array that needs to be added to the $array; $array = array([66316] => 66316,[66317] => 66317,[66318] => 66318); how should it be done??
Set Values Once
let say that i want to allow someone (the site admin maybe) to chose certain configuration values, for instance * number of products per page * picture widht * back color .... Right now, i just have all those info in a php page, so it can't be modified $number of products_per_page = 20; $picture_widht = 2; $back_color = #FFFFFF; I could keep this info in the database, but i should read it every time a page is rendered... (open connection, query, close conn) What would be the best way to do what i'm need? Is there any chance to "read once, keep value for ever" ?
Checkbox Values
Basically, I have 2 checkbox's which are printed out for each record within my table. On the next form, each checkbox is tested for being "checked" and the database is updated accordingly. This is fine. My problem is that I dont want users to be able to select both check-box's at the same time. After talking to "andnaess" on an earlier post and doing some reading, I decided upon using some javascript to do what i wanted. I have found a script which does exactly what i want, and i am now incorporating it into my original php script. I am having problems assigning a name and value variable with an array to my checkbox's. Is this possible, or have i got the wrong idea?
Combo Box Values
I have values in a combo box where datas are coming loaded dynamically. When an user selects a particular value and press search, even after refreshing the page, I want to keep the value same as the user selects. For example suppose if I selects value PHP from combo box, after submitting the combo box should value highlighted must be PHP. IS there any way I can do this?
Reading Url Values
I am able to pass values to the URL as this shows. I can get the id value and select data from mysql, but I cannot access the ln value. I have use various combos and acannot get it to read the ln value and display it. What am I doing or not doing? I have used get, post and result: $id=$_GET[id]; $ln=$_POST[ln]; echo $_RESULT[ln]
Echo Certain Values Only
I'm creating a table that has 7 columns. In the first column, I'd like to show My_SQL data. The data contains multiple fields, but there is one that matters most right now. Right now, I show this data with: <?php echo $row_UserData['Number'];?> However, I only want to echo this value if another value of the same row ($row_UserData['Code']) equals a certain number. How would I write a conditional statement like this?
2 Values In A Loop
In a guestbook the im building, I want to set the <tr> bgcolor in a difrent color each msg (the same effect is also here in these forums).The code is a while loop (to get mysql results). How can I do it ?
Monetary Values
What is the best way to remove all characters except digits from a string? ie: I may have a value: '$4,000.00' but all I want is 4000
Values From A Form
I have a form (search.html) that has 1 textbox and 3 listboxes. When I submit this form to a php file (search_res.php), I am using $HTTP_POST_VARS to get the values which is fine. But then in my php file(search_res.php) I again have a listbox with 2 options. When I choose either one of these options to display the search results either by "Price" or "Name" I lose the values of the main form (search.html). How can I keep these values from the main form in my search_res.php page?
How Do You Add Values In Rows Together
I am using the following code to take records out of a Mysql database and display them on an HTML form. $myrow[8] is a number. At the bottom of the table, I want to display the sum of all the $myrow[8] values added together. Code:
Return Values
I have an idea about returning variables. in 1st page, there's variable "x1". it's action page is B. So, I can use "x1" in B. $x11 = (int)$_POST['x1']; B's action page is C In that case, I want to use "x1" in C. So, can I save "x1" in B and use it in C? for exmaple, can I use following commend in C? $x22 = (int)$_POST['x11'];
Adding Different Values
How can I do If I need to add some values, I am using LEFT Join and I am displaying some lists There is my code: PHP Code:
Selecting MAX Values
I have a SELECT statement where I use numerous GROUP functions, namely: SUM, MAX and COUNT to query and combine various elements of a table. My question lies around the MAX() function. The field which I am querying for the MAX function is a TINYINT field named HS with numbers ranging anywhere from 0 to 375. However, there is a second TINYINT field named NO which is also tied to it. Basically I would like to add a "*" to the end of the HS field if the NO field is set to 1. If it is set to 0 I would just like it to display the number in the HS field alone. Is it somehow possible to select the NO field of the specific MAX value in the query? If that can be done then I can combine it when writing my php.
Compare Values From CSV.....
I have a CSV file which contains data from the search engines, which includes search engine, keyword, number of applicants and number of visits. However in some cases there is repitition however I want to merge those figures together. An example of what I mean....
Array (add More Values To The End)
I have an array. I wan to add more values to the end of the array. how would i go about doing this. my current code does not work. PHP Code:
Getting Values From A File
I have a file with content like: John|10|5|7 Alec|22|9|31 Mike|23|42|1 And I can retrieve all the values using explode and a loop. But for what I'm wanting to do is be able to get the values for one particular line rather than the entire. So how can I retrieve the values for one particular line?
Get Values From Textfield
as I am new to PHP my question is related to pure basics. I wrote simple PHP file for automated mail sending. It sends, of course, mail with fixed text but I need "mail()" function to retrieve string values from textfield controls in Dreamweaver instead of fixed string values.
Option Values
From my experimentation there seems to be a difference when using values from an option value as apposed to an value by a check box etc. I can quite easily input data from a check box selection, but not an option value. Code:
SSL - No $_POST Values
The problem I had was sending posted data to a SSL secure Apache server and when getting the values using $_POST they were empty. The cause of the problem can be found here http://bugs.php.net/bug.php?id=18759&edit=1 It seems that having enctype="multipart/form-data" in the form tag was causing the problem.
Matching GET Values...
I am trying to pass each GET variable to a function and check if it was expected. For example, here is a sample link: index.php?name=modname&file=filename&func=1 the problem is, instead of returning: match match match it returns: match no match no match no match match no match no match no match match I know the problem is something with the =each, because it is evaluating each item against each other, I just don't know how to fix it. function bmcheck ($bmc, $g) { $bmchk = 0; while (list ($key, $val) = each ($bmc)) { if ($val == $g) { echo "match"; echo "<br>"; } else { echo "no match"; echo "<br>"; } } } $bmc = array("name","file","func"); foreach ($_GET as $gvalue => $g) { bmcheck($bmc, $gvalue); } Basically, when I'm done, if something like this was passed: index.php?name=modname&file=filename&func=1&bad=notsupposedtobehere then I would see 3 "matches" and 1 "no match" for the "bad" parameter.
Get ASCII Values
is there a php(inbuilt) function to get an ASCII value of a string? if isn't ,please explain how to do it I had wanted to send redirection from a page to another page in same folder .used below code but didn't work though didn't show any error messages.could someone tell where it went wrong? Code:
PHP Null Values
NULL is converted to blank in php array when i use mysql_fetch_array . I want something where NULL remains as it is in php array.
Variables Not Getting The Right Values
I have a form that has the ID values of various fields from listboxes, etc., which are generated from a db query, assigned to variables. The variables hold the returned $_POST['fieldvalue'] fine, but I also need variables to hold the labels. I have tried a few options such as running a secondary query where the selected form value = the label, i.e. -sample code- //set variables: $tooltype_id = $_POST['toolType']; $toolcat_id = $_POST['toolCat']; $primeproj_id = $_POST['project']; //get group and project code and set variables $query_groupcode = "SELECT groupCode, projCode from groups, proj WHERE groups.groupID = proj.groupID AND proj.projID = '$primeproj_id'"; $groupname = $query_groupcode['groupCode']; $projcode = $row_projects['projCode']; //get tooltype codes $query_toolpath = "SELECT toolType FROM toolType WHERE toolTypeID = '$tooltype_id'"; $tooltype = $query_toolpath['toolType']; - end code - I then checked to see the variable values: -code sample- echo $tooltype_id.' tooltype_id<br />' echo $toolcat_id.' toolcat_id<br />' echo $primeproj_id.' primeproj_id<br />' echo $groupname.' groupname<br />' echo $projcode.' projcode<br />' echo $tooltype.' tooltype<br />' -end code- this is the result - the data from the db comes across only as 'S': 2 tooltype_id 3 toolcat_id 5 primeproj_id S groupname S projcode S tooltype I'm sure this is just a stupid little error that I'm not seeing....or that there is a reasonable way to collect the label values.
Reading Values From Url
what am I doing wrong? I've got a link like this: <a href="dispcalendar.php?month=1&year=2007">view the calendar for the rest of the year.</a>then on dispcalendar.php I have: showYear($month, $year);But it doesn't seem to be reading the values sent in the url as I just get a blank page.
Getting Form Values
I have so far been trying to get all selected check boxes on the page, quantity text fields and ordernotes text area to INSERT INTO my database but to no avail. Im using OBDC to add to the confusion. I've tried to develop my 'product' script into some kind of a form, but now need to find out how to make the data i want variable so that i can send them into my database. Code:
Incrementing Values? $var++
I want to be able to get the highest value from my user_id field in the database and increment it by 1. So highest user id is 104... next user will be 105 etc. I have the below code but it doesn't seem to be doing. It just puts the value in as 1 all the time. the job. $query = mysqli_query("SELECT MAX(user_id) `user_id` FROM `phpbb_users`"); $fetch= mysqli_fetch_assoc($mysqli_connect, $query); $get_val= $fetch['user_id']; $get_val++;
HTTP_ACCEPT_LANGUAGE Values
I'm trying to pull the language tag out of HTTP_ACCEPT_LANGUAGE in the $_SERVER superglobal, and while I'm certain of most of the regular english encodings, I don't know many of the international ones, is there anywhere I can find a full listing of all the country tags? In particular I'm looking for Chinese. I've checked the HTTP 1.0 and 1.1 specifications and couldn't find a listing there. I've looked through some PHP references, even though this is in the Headers department.
Hidden Values
Can any one help me in using hidden values with a form that posts to it self the form has 2 fields one of them is selection from options I want the values of the fields to be there once the form is posted to it self. I have tried to use the following with the form, but it didn't work. Code:
Displaying All The Values
I want to display all the values from a colum that matches. Right now i am only displaying the the last value that was inserted in know it has to do with $row['value'] but i am not displaying anything when i do it that way so here is my current code:
Insert Values
I have a bunch of information that I want to insert into a table insert into TABLE values ('hello','I','am','lost'); pretend that the words that are being inserted are coming from a form for another page. In he case I above I have declared that the table has four columns to insert into. What if I do not know how many columns there are?
Get Multiple Values
I have an e-cart application and need to email a reciept of purchases. My email will only send/display the last set of purchases. ie if two items are purchased only the detail of item 2 is sent in the email. The code use a function to retrieve the product info and then I use extract to create variables to be referenced in the email. Code:
Passing The Values
The file name is visit.php I have a search option and 1) user will give a value 2) the page will search and give the output. Now i want to pass the values to another <?PHP ?> code which is inside the the same file in visit.php ok here is the example Code:
Trying To Pass 2 Values
I am trying to pass 2 values in the URL, but for some reason they keep combinine to each other... I wanted to send over the groupid and the zipid, but it keeps sticking them together. Code:
Getting All Select Box Values
I'm running into a problem with a select box. Its values in PHP are not properly parsed. <select name="frm_owners" size="10"> <option value="1">Apples</option> <option value="2">Oranges</option> </select> Now, if I were to select both options and then output $_POST[frm_owners] on another page, all I would get is "2." But I'm looking for a comma-seperated value like "1,2." Any ideas?
Passing Values
The problem is that I have 3 different pages (classic, business and VIP) which links to the contact.php page and in these 3 pages there are 3 different banners, menu and footer. And in the (3) footer file there is one common link to the contact page what i did was from the Classic footer i passed this value <a href="contacts.php?frompage=Classic" class="bottom_link">contact</a> and from the business footer i passed this <a href="contacts.php?frompage=Business" class="bottom_link">contact</a> and from VIP footer i passed this <a href="contacts.php?frompage=VIP" class="bottom_link">contact</a> and in the contacts.php page i did this <?php $mypage = $_REQUEST['frompage']; ?> and from this variable i managed the header, menu and footer <?php if ($mypage=='Classic') { include("includes/header_classic.php"); } elseif ($mypage=='Business') { include("includes/header_business.php"); } elseif ($mypage=='VIP') { include("includes/header_vip.php"); } ?> same code follows for menu and footer But what happened is when i Submit the form and save the information in database (all the values) gets saved, the header, menu and the footer gets lost... I know because while submitting $mypage variable gets blank and due to this the headers are not showing, how shall i retain the value from this variable while i submit the form or the page refreshes.
Comparing Array Values
I'm developing a database that holds information about crew members. There are 7 categories of service types. Crew members can be associated with any number of categories. I'm working on an update form to add or delete categories for a crew member. I first issued a query to find the member's categories. I issued a second query to list all possible categories. I want to show a checkbox for any possible categories that aren't in the member's individual category list. If the member is in categories 1 and 2, but not in 3 or 4, I want to show a checkbox for categories 3 and 4. I can get the two category lists to print, but I can't figure out how to compare them. Here is the code I have for the select statements: Generates the list of member categories: $cat_query = "SELECT crew_category.crew_id, crew_category.category_id, category.category_desc FROM crew_category, category WHERE crew_category.crew_id = "$crew_id" and crew_category.category_id = category.category_id"; $cat_result = mysql_query($cat_query); Generates the list of all possible categories: $all_cat_query = "SELECT category_id FROM category"; $all_cat_result = mysql_query($all_cat_query); I'm just developing my programming skills (as I'm sure you can tell), so I apologize for my ignorance! Thanks in advance to anyone who can help!
Ending Foreach Before It's Run Through All The Values
I've got a tiny question: Is it possible to end a foreach loop before it actually passed through all values ??? e.g. I got an internal counter in a foreach loop. now if the counter hits a defined number, the foreach loop shall end. I know this is possible by exiting the script, but I just need the loop to end. the rest of the code past that loop must be parsed as well.
Comma Separated Values
What i've done is when the user enters the client list separated by commas..... this works, but I need to know how to warn the user when they have enter the client list with no commas. Is there some sort of function which does this or is it a regular expression thing??
Sorting Number Values
I got 3 variables posted through a form. They are transferred to variables $a, $b and $c respectively. I need to make it so that the values are sorted where $a = smallest value $b = Largest value and $c = second lasrgest value. Basic example is: $a = 500; $b = 350; $c = 400; Values for each variable may vary at different times. after sorting : $a = 350; $b = 500; $c = 400; $b always should be the biggest value and $a should always be the smallest value. I have heard of the bubble sort ... is this something I should use ?
Php And Extracting Textarea Values
I have a textarea where I am collecting comma separated values, for example: 23213,smith,joe,mytown,MS 34565,dfdfdf,sds,dsds,dsd 32323,ggasd,jgfj,sds,sdsd 74743,hhsdfs,hh,sdf,sffff What I want to do is explode each line as a single entry into an array. PHP Code:
Remember Form Values
I have a form, and I'm using PHP to make sure the users filled in certain fields. If they haven't filled in a field, they are brought back to the form after submitting (using header location) and asked to fill it in. However, when they go back, the form values are all gone. How can I keep the form values there? I know i've seen it done, but I can't remember where.
|