Dynamically Creates Varibles
i have this script for that uses 7 pulldowns for the time of an event each day of the week that gets inserted in to a db. Instead of writing the script 7 times for taking the data from the pulldowns, creating a time based on the hour, minute and AM/PM -can i create something that dynamically creates varibles. Basically takes something like $hour1, $minute1 and automatically creates $hour2, $minute2 and so on. This is kinda difficult to explain, heres a snippit of code which i want to duplicate.
View Complete Forum Thread with Replies
Related Forum Messages:
Dynamically Populate Drop-down List And Dynamically Include Html File
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the drop-down list will be poplulated from the product.txt file, and there will be a file for each corresponding item in the drop-down list. From the user point of view, if he wants to add a new product, he will just need to open the product.txt file, and add a new line with the product name, "Laptop", then add a new text file named "laptop" in the same folder which contains the HTML fragment to be included in the content area. What is the easiest way to do this?
View Replies !
Putting Together Varibles
$id = ($_GET['id']); $ifid = ($_GET['ifid']); $name = ($_GET['name']); $resolution = ($_GET['resolution']); $ext = ($_GET['ext']); $fullname = "$ifid_$name_$resolution.$ext"; when i echo $fullname, it doesnt display the idif, name, just the resolution and ext. i need it to give this format: 01253_silence_1680x1050.jpg
View Replies !
Session Varibles
I have read that it could be possible for some one to change session varibles if you are using a shared hoast, if you leave the sessions in the defualt directory? is this correct? can i secure it by changing the directory?
View Replies !
Constants Or Varibles?
Throughout my site im going to need my database info ..Now what i have done is setup a header (header.php) , that i simply required_once('constants.php'); and inside constants.php is my database info and some other constants that i use. Code:
View Replies !
Sending And Grabbing Two Varibles
I send one variable to next page like this: echo "<td><a href="/Product/Member.php?ID=".$MemID']."">".$row['MemID']."</a></td>"; I catch on the next page like this: $MemID=$_GET['MemID']; can any one help me how can I send and catch 2 variables...
View Replies !
Variable Varibles With Array.
I'm trying to use variable variables to access fields from a db. I have code that works, but I don't understand why I need to declare it as a variable outside of the array as well. What I have: $fname = 'fname'; // Why do I need this?? $fieldList = array('fname'); $output = $row->${fieldList[0]}; This works, however... if I leave out $fname='fname' it does not work. I read the docs, and tried $output = $row->${fieldList}[0] but that doesn't make sense when accessing a property of the row object. Is this the way it is, or am I doing something wrong that I need to double up on my field declarations to get them as a passable array? This way, I will need to declare every field in the db I want, then put it in the array which just seems strange.
View Replies !
Recalling Stored Varibles
Ive got my basic login system which stores the users entered login empID and password. What I would like to do is recall this empID to be entered into the DB when another query is run so that the user does not have to re enter it. Here is what i have so far. $sql="SELECT * FROM Employee WHERE empID='$empID' and pass='$password' and position='employee'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" session_register("empID");...
View Replies !
Automatic Posting Varibles
I'm trying to automacticly post 2 varibles from one script to another. I have a form with an email & password field. I pass that to another page which has to redirect and post the varibles it collected to a final page where the user will be logged in. It's going from two php scripts to a propioraty system. I know it's a round about way to do it but it's the only way I can think of. How would I go about doing this?
View Replies !
Adding Varibles In To HTML
I am setting up a payment system for my site using paypal, i have the script to create the button to create the invoice for the customer, but i need to add the correct details in to the HTML for the button . I have a form in which i will get these varbiles from, but for testing purpuses i have created teh varbiles at the top. Code:
View Replies !
Varibles In An Exec Commmand
Is it possible to put varibles in exec command?, because ive tried and had no luck. I need to put a varible file name into it, the file name varible is working but it thinks that its non-php, heres what i have: PHP Code: <?php exec('mencoder vids$filename -o vidsencoded$filename.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=7000:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames'); echo '<h3>Encoding Successful</h3>' include 'ftp.php' ?>
View Replies !
Parsing Varibles Issue
it should get the user variable, but its not: <form action="?proc=1&cid=<?=$cid?>&user=<?=$user?>&subid=<?=$subid?>" method="POST"> PHP Code: <? include('lib/conf/config.php'); ?> <html> <head> Â Â Â Â Â Â <title> :: Syc0tests - Powered By: CORE Contest :: </title> Â Â Â Â Â Â <link rel="stylesheet" type="text/css" href="lib/css/style.css"> </head> <body bgcolor="#2A2922"> Â Â Â Â Â Â Â <? Â Â Â Â Â Â Â Â if ($proc == Ƈ') { ...
View Replies !
PHP Varibles Inside Template Files?
I have a template file that has some PHP variables inside of it. I would like to pass through the template and evaluate any variables inside the template file. I have "tags" around the PHP variables. <<TEMPLATE FILE>> blah html code <MARKER>$variable1<REKRAM> blah html code I can write PHP code to go line by line through the code to find the "marked" code. $myLine=preg_replace("/(.*?)<MARKER>(.*?)<REKRAM>(.*?)/","$1$2$3",$myLine); The above code works fine in removing the "markers" but it does not evaluate the PHP variable. How do I eval() $2 (the PHP variable)?
View Replies !
Warning: Cannot Add Header Information - Memory Varibles?
Warning: Cannot add header information - headers already sent by (output started at /var/www/html/redhat7.0/php-4a.php:7) in /var/www/html/redhat7.0/php-4a.php on line 81 //include "aboutus.html"; header("Location: http://france.myserver.com"); exit; what is the error message mean; do I have to clear the some memory varibles? because the same header was in other index.html I can't do really understand what is causing the error or cure?
View Replies !
My Insert Creates
I cannot figure how to fix it. That snippet should be used to grab an ID which it does fine Then insert that ID in a col named "member_web_address" As mentioned it does get the ID and insert it But not on the row where from the ID was taken . It does insert it on a new row created by the insert action Which due to the auto increment creates a new ID etc... How can I keep the original row and pass its ID # to the "member_web_address" col in the very same row <? $query = "select id from templates where username= '$username' and page= '$page' "; $result= mysql_query ($query); while($query_data=mysql_fetch_array($result)) { $member_web_address=($query_data["id"]); } $query = "select id from templates where username= '$username' and page= '$page' "; $result= mysql_query("insert INTO phplates (member_web_address) values ('$member_web_address')"); ?>
View Replies !
Creates The Session
i have a field in a database called Password. It is based on 'password' that a query on the rest of the database is run. The query uses sesions. I attempt to login to thru a login page with my 'email' and 'password'. This is the page which checks that the login details are correct and it creates the session Code:
View Replies !
Fopen Creates Files?
According to the PHP documentation fopen will create a file that it is directed to open with write access if it doesn't exist... It may be my current host, or I may be doing it wrong, but it doesn't work. Code:
View Replies !
CURL Creates New Session
I currently have a curl session that can access hundreds of different pages on a site. One thing I noticed with it is that it is initiating a new session of the server that is accessing. I don't want it to create a million sessions, just use the one it currently has. I am going to guess that if curl_close($ch) is called, then it is is reinitiated curl_init, it restarts the session correct.
View Replies !
Cron Job Creates Php Files
I have a cron job that is running on my server. Its set to run every half hour. It works great, but it has an annoying little quirk. Everytime the cron job is run, it creates a php file in the root directory of my server. Since its running every 1/2 hour, I get a bucnh of files on my root directory and I have to manually delete them everyday. I've posted the code for my cron job below.
View Replies !
Looking For Script That Creates List Of Referrers
I've been looking for a script that will create a real-time list of 'top referrers', similar to the links to sites you see on the left of the page at http://www.linkswarm.com. They also have a page http://www.linkswarm.com/referrers/referrers.php which shows all referrers. I'm assuming you'd be able to set filters. There is no signup required, you just link to the site and your site appears in the referrers list, but as a webmaster, you wouldn't want to include search engines for example.
View Replies !
Creates A Database On Any Server Via A Web Page.
I have basically an install script that creates a database and all the tables and fields. This works great on the local IIS I have on this machine, but that's because I have 1 password for all databases. THe database cannot be created when I run this on the server that hosts my websites (which is a remote server that I rent space on, it's not in my control). I'm trying to figure out if what I want to do is possible. I want to have a script that creates a database on any server via a web page.
View Replies !
Netscape Creates 2 Files For My Sessions
I am having a problem with Netscape when I try to create session variables on two different pages. Netscape produces two separate session temp files ... one with the Redirect.php session variables... one with the Results.php session variables... both have an unique sessionID. IE works fine (in that it creates one session temp file for all variables). Here is the code I am using: PHP Code:
View Replies !
Mysqldump Creates 0 Bytes File!?
i found some simple code for dumping mysql database but whatever i do (change path to mysqldump, change arguments, change functions) it generates 0 bytes file every time! why is this happening? how could i debug my code? Code:
View Replies !
Script Creates Owner As Apache
I am using a fantastic script called Photofolio from www.billwadman.com/photofolio and everything is awesome with it except that when you call the file "buildthumbnails.php" and it builds your thumbnail folders it creates them with the owner name as "apache" and permissions at 644. The problem here that you may suspect is that I cannot go in and delete those files in any of my FTP programs of DW because I am not the "owner". My hosting company says I will have to manually lodge a ticket each time to have the folders deleted. THis seems like a pain in the arse. could anyone offer any help into this situation? or will this really be the case that they will have to delete the files. The only other option I see is Bill Wadman creating some sort of script that will go in and delete the fies or folder directories for you.
View Replies !
Mysqldump Creates Empty File
I have the following code running on a Windows PC (it actually needs to work in a Linux environment on live but still developing it). It seems to create the a.sql file but there is nothing in the a.sql file even though there is data in the database....
View Replies !
MySqldump Creates Empty File?
I am Trying to create a one click backup database script so non-geek office staff can do this, but so far I can only output empty files $db_user = "root"; $db_password = ""; $db_database = "or"; $db_server = "localhost"; $backup_path = "C:xampphtdocsopenrealadminackup"; $path_to_mysqldump = "C:xamppmysqlin"; $filename = "backup".date("YmdHis").".sql"; shell_exec ("mysqldump $db_database > $path_to_mysqldump.$filename --user=$db_user --password=$db_password"); I have tried various forms of this syntax with no content output?
View Replies !
Securing Code That Creates Images
I have a pretty nice php web site, that's also reasonably secure. However, I wrote some php code to create some dynamic images based on database data, but I can't figure out how to secure this script? when I reference the php code via img src="myimage.php", none of my session variables are available for use in the script. So, without my session variables, how am I suppose to ensure that the script is only run by a valid user, rather than just anyone who can blindly type in random parameters to my image creation script?
View Replies !
'exec' Creates Popup Windows
I'm running php under apache (I'm using the uniserv distribution) on Windows XP. Every time I execute an external command using backticks or exec or system, I get a cmd windows that pops up for the 1/4 second the command executes. This would all be fine, except that I'm deploying the server to run locally on the user's box, and needless to say, the popups are annoying. I've search everything I'm clever enough to understand and can't find a way to get the external commands to run in the 'background'. All of the input and output of the commands have been redirected, any shell command causes this behavious, and in all other respects it all seems to work great.
View Replies !
Verify Page Which Creates A Session
I am new to sessions and php and have been playing around with them - and would like to know why this is happening? Firstly I have a login page and it goes to a verify page which creates a session like so:
View Replies !
Creates A Cookie And Redirects It Automatically
i am migrating my ASP code to PHP and I have a problem with redirection i have a code here that creates a cookie and redirects it automatically but the problem is that... on the first event that a user visits the page... the cookie is created but it does not redirect automatically. on the second event that a user visited that page, it redirects the user to another page. Code:
View Replies !
Creates Some Session Variables After Validating The User
I'm new to PHP... I wrote a php script for login page, which creates some session variables after validating the user... But it's not working... When i compile it... The compiler is giving me the following Warnings... ---------------------------------------------------------------------------------- PHP Warning: session_start(): open(/var/lib/php/session/sess_f207f20079897ad6f830fc632fa5e0c0, O_RDWR) failed: Permission denied (13) PHP Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/gana/public_html/login.php:4) PHP Warning: session_start(): Cannot send session cache limiter - headers already sent PHP Warning: Unknown(): open(/var/lib/php/session/sess_f207f20079897ad6f830fc632fa5e0c0, O_RDWR) failed: Permission denied (13) PHP Warning: Unknown(): Failed to write session data (files). (/var/lib/php/session)
View Replies !
Script That Creates A Smaller Version Of Image.
I have a dynamic image. i.e it keeps on changing. What i want to do i make a script that creates a smaller version of this image. like 50% width and 50% height. i want to place it elsewhere. But the thing is this smaller image should change when the original image changes too.
View Replies !
A System Automatically Creates A Copy Of A Php Page.
What I want to do is for people to put information into a form and after they hit "submit" a system automatically creates a copy of a php page. Then, it inserts the inputted info from the form in the new php page. The pages would be numberically named and accessed easily like this. Everything is set up on the php page where only variables are needed to be changed. How do I take the submitted variables and write it into a newly created numbered page and insert the variables?
View Replies !
$_SESSION Problem - Page Reload Creates New Session ID
I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 The problem I am having is that each time I reload the same PHP page, I get a different Session ID (and thus all session vars are lost from one page to another). let's say in firstpage.php I set $_SESSION["firstvar"] = "someval"; $_SESSION["secvar"] = "otherval"; and in secpage.php I try to retrieve $_SESSION["firstvar"] , it gives me "Undefined Index error" I did not know what is happening and when printing out the session id (echo SID;) I found out that the ID is changing every time page is reloaded or when moving to another page. The problem is that I don't know what might reset the session since I use "session_auto_start" and have not played with session_start, session_destroy or anything else.
View Replies !
Creates A Dropdown List Of Information Belonging To That User.
I have a page that uses php to look up specific fields in a specific table of a specific database based on the username. Using this, it creates a dropdown list of information belonging to that user. The fields in question each have 13 pieces of data. Based on what they click in the dropdown box, I need that specific data to pass onto hidden fields on the page. Code:
View Replies !
Unable To Write A File In A Directory That My PHP Script Creates
I've a problem of being able to create and remove a directory but unable to write a file inside the created directory for some strange reason. I suspect that this problem could be vaguely linked to Safe mode being set to On since my site is using shared server hosting and probably insufficient/incorrect Unix file permission. Below is my test script that helps me narrow down the problem. -------------------------------------------------------------------------------------------- <html> <head> <title>File IO Test</title> </head> <body> <pre> <?php define("TEST_DIR", "./newsletter/2005_11"); define("TEST_FILE", "./newsletter/2005_11/file_io_test.txt"); echo "Make Directory"; if(mkdir(TEST_DIR, 0777)){ echo "<font color="green">OK</font> "; } else{ echo "<font color="red">Fail</font> "; } if(file_exists(TEST_DIR) && is_dir(TEST_DIR)){ echo TEST_DIR . " exists. "; } else{ echo TEST_DIR . " does not exists. "; } echo "<hr> "; // TEST FILE WRITE echo "Write Open File"; $file_handle = fopen(TEST_FILE, "w"); if($file_handle){ echo "OK"; } else{ echo "Fail"; } fwrite($file_handle, "This file is written at " . date("Y/m/d H:i:s") . " "); echo "Write Close File"; if(fclose($file_handle)){ echo "<font color="green">OK</font> "; } else{ echo "<font color="red">Fail</font> "; } echo "--- START FILE DUMP --- "; readfile(TEST_FILE); echo "--- END FILE DUMP --- "; echo "<hr>"; ?> </body> </html> -------------------------------------------------------------------------------------------- This script will report a success with the creation of the directory on my server, but fails to write a file inside the newly created directory. Originally, I only call mkdir without specifying any permission and it doesn't work. Thus I explicitly instruct mkdir to use 0777 to allow all write operation by everybody, in case PHP and Apache try to write files using "nobody" or "www" user account, instead of my shell login user account. Still it doesn't work. The owner of the created directory is called "www". When I login via SSH and check the permission, strangely, the permission is 775 instead, with Write permission for Others disabled, although I told mkdir to use 0777 instead. Is there any workaround, and what am I doing wrong here? Thanks for sharing with me any insight into this problem. I'm not quite sure what exactly is wrong here, whether because of PHP Safe mode, incorrect directory permission, incorrect file permission or the case of different UID or owner.
View Replies !
Creates A Simple Text Box For The User To Enter Details In.
I'm using a Mambo component (Remository) to output details about files for download. The code below shows what's there at the moment. PHP Code: $this->fileOutputBox(_CUSTOM_4,'custom_4',$file->custom_4,25); This creates a simple text box for the user to enter details in. However, in some fields I want to limit the options available by having a select drop down box. In other fields I may want to supply the values in the select drop down from other fields in the db.
View Replies !
Creates Generates A Download Link Which Is Active For One Hour Only
I'm making a system which creates generates a download link which is active for one hour only. I wanted to make it cookie based, but I'm having troubles setting the expiry time of the cookie correctly: $timestamp = time(); $expires = $timestamp + 3600; setcookie("DOWNLOAD_ID", $hash, $expires); In Firefox the cookie is set correctly to expire in one hour from the current local time. In IE and Opera it sets the expiry time to one hour in GMT. The server is in the same timezone as the client machine (for now). How to I make sure that the expiry time of the cookie is set to 1 hour in local time ?
View Replies !
Xml Parsing Issue - See Some Extra Information Which Creates Problem
I am using for web service client and been able to get correct results. Now i have problem in parsing it, I have methods available for this either get data form array which in user debug or i can parse the xml. When i put the who xml in file and try to parse it it works file, but when i try to parse it directly you can see some extra information which creates problem, please check this issue and help me out. Code:
View Replies !
Function That Reads The Content Of The Images Folder And Creates Hyperlinks Of The Subfolders
I have a folder "images" in which different other folders are stored. Like "party" or "car" or "holiday". In those folders are JPG's stored. I am looking for a function that reads the content of the images folder and creates hyperlinks of the subfolders (with the same name as the folder) when i click a hyperlink I want the pictures in that folder to be loaded and shown as tumbnails. So when i add an new folder with new pictures i want to have a new hyperlink which shows the new pictures.
View Replies !
"insert Into" Statements Handle Varibles
I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their first name, last name, email, etc. The data are then sent to a PHP script (reg.php). The data are then inserted into a table (reg) in MS SQL server. I have declared the variables like this: if (!(isset($_POST['FirstName']))) { $FirstName = "" ; } else { $FirstName = $_POST['FirstName'] ; } Then I said the following to make sure people fill in all the info: if(empty($FirstName) OR empty($LastName) OR empty($Email)) { echo "Oops, you must complete the form to register. Please use the browser back button to go back and complete the form."; echo "</body></html>"; exit; } The statement that insert the data to the table is like this: $qry = "insert into reg values ('$FirstName','$LastName','$Email')"; However, this doesn't work. I looked into examples online, but none of the "insert into" statements handle varibles (they all insert actual values such as "Hanna, Smith, hs@yahoo.com', etc.)
View Replies !
Creates A Temporary Folder And A File Within The Folder.
I have a PHP script which creates a temporary folder and a file within the folder. I have a problem when trying to remove the file and folder using my FTP program. The ownership and group are set to NOBODY. I cannot change the permissions on either the file or the folder. I have tried chmod and chgrp and chown but for some reason I cannot change permissions.
View Replies !
How To Dynamically Name Variables?
Lets say I have variables named: name1, name2, name3, and name4. How can I call them without having to name them everytime. Something like for ($i=1; $i<=20; $i++){ if $"name".$i { do this } I've tried everycombination I can think of, but am totally confused. I had no trouble naming the variables dynamically in a form, but I can't get php to call them dynamically.
View Replies !
PHP To Dynamically Generate XML
I am interesting in using PHP to dynamically create an XML document and then use XSLT to transform to XHTML. I have come across two methods for doing this. I made two equivalent examples so you can see what I mean. http://members.shaw.ca/petermichaux...SLT_method.html I am interested in critisim of how I implemented each method. However my main problem is deciding between methods. Which method is better for bigger programs where the bits of the XML data are assembled by various php functions that I write? For example, one php function queries a database table for a list of CD titles. A second php function loops through this CD title list and gets the track listing for each CD from another table in the database. Then the composite XML data (ie. CD title and tracks as nodes) can be tranformed to XHTML.
View Replies !
Dynamically Edit SQL
I would like to have my results of an SQL query populate a tabel, which i have already set up and is functioning well. However now i would like to have another page, where the informatino is editable. What do you guys think the best way to set up a table that a user can edit the information in a SQL database without entering PHPmyAdmin?
View Replies !
Dynamically Build
I am using php/mySQL to display a photo gallery. I have it working OK at the moment if I want to display all photos from the database. However I would like to smarten up the page a bit. Each of the photos in the database are arranged into catagories so I would like to use a drop down menu to allow the user to filter the photos by Catagory. My plan would be to build a drop-down menu based on the catagories stored in the database. The user would select the catagory then use a submit button to rebuild the page with the new filter as part of the query. 1) How do I dynamically build a drop-down menu. 2) If the user selects an option from the drop-down menu how do I store the value selected and use it to filter the MYSQL query.
View Replies !
Dynamically Loaded
I anticipate wanting PHP to evaluate a lot of expressions and would rather not create subprocesses to do it from inside my C program. I've googled around for calling PHP from C, and know Apache does it, but my C program won't have a full Apache environment. Can the libphp.so be used otherwise?
View Replies !
Dynamically Determines
I want to create a page that dynamically determines how many fields the next page (a form) will have. Example, first page is "How many fields do you want?" with a drop down... user chooses a number from the drop down, the next page has a number of blank fields equal to the number the user selected on the first page. Is this possible? If so, how would you do something like this?
View Replies !
Dynamically Typed
Why scripting languages are dynamically and weakly typed? and why none of the scripting languages is compiler based? why cant a scripting language be use like java or c++ where we can catch type errors e.g. (string being assigned to an integer), parameter passing at compiled time. what is the significance of multiple dollar sign ($$...$var) in php? e.g. $var = "profession"; $$var = "doctor"; $$$var = "khalid"; and so on...
View Replies !
|