Re: [PHP] Passing Values between C App and PHP
Tobias Krieger wrote: > This would be a nice and fast solution, but unfortunatelly, it's like > that the C programm needs to surveilance the hardware all the time > (controlling values,...) hence, it would run more as a "daemon". > Depending your skill-levels with C, there is not much to it. Here is some fairly simple code I use for a daemon that controls an IOM142 (google it) board via the serial port. http://jessen.ch/files/fridged.tar.gz It's very much "send two-byte command", then "receive multi-byte response", but it also responds to simple http-style requests and I call it from php to produce this page: http://jessen.ch/refrigeration/ (in dire need up an update). /Per -- Per Jessen, Zürich (14.4°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing Values between C App and PHP
if memory serves... you can look into using a shared memory block, or pipes to communicate between the php/c app -Original Message- From: Tobias Krieger [mailto:tobias.krie...@teamfrednet.org] Sent: Sunday, June 21, 2009 2:44 PM To: Nathan Nobbe Cc: php-general@lists.php.net Subject: Re: [PHP] Passing Values between C App and PHP Am 21.06.2009 um 23:31 schrieb Nathan Nobbe: > On Sun, Jun 21, 2009 at 3:25 PM, Tobias Krieger > wrote: > Hi, > > I've recently written an eMail regarding I2C and PHP - since I > haven't found a nice solution yet, I'm considering writting the I2C > part (opening device, writing, reading,...) in C (that's simple) and > to recieve (and returning) the values through PHP and Javascript. > > E.g. Website (PHP/Javascript) -> set a new motorspeed -> PHP passes > the new speed to C Application -> C AP opens and writes the new > speed onto the I2C Bus -> Motor executes -> returns ack -> > > Is this somehow, and not complicated possible? > > if the C program is written such that it can start and stop on every > request rather than as a daemon, its as simple as shell_exec(). > > write your C app to take args over the cli and then pass them in > through the call: > > $result = shell_exec('myI2C -speed 50'); > ?> > > something of that nature. > > -nathan > This would be a nice and fast solution, but unfortunatelly, it's like that the C programm needs to surveilance the hardware all the time (controlling values,...) hence, it would run more as a "daemon". thx, tobias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values between C App and PHP
On Sun, Jun 21, 2009 at 3:44 PM, Tobias Krieger < tobias.krie...@teamfrednet.org> wrote: > This would be a nice and fast solution, but unfortunatelly, it's like that > the C programm needs to surveilance the hardware all the time (controlling > values,...) hence, it would run more as a "daemon". > then you will have to make the C app accept socket connections; or maybe try unix signals handlers in the C app w/ shared memory betwen both processes; maybe there are easier ways to do it.. -nathan
Re: [PHP] Passing Values between C App and PHP
Am 21.06.2009 um 23:31 schrieb Nathan Nobbe: On Sun, Jun 21, 2009 at 3:25 PM, Tobias Krieger > wrote: Hi, I've recently written an eMail regarding I2C and PHP - since I haven't found a nice solution yet, I'm considering writting the I2C part (opening device, writing, reading,...) in C (that's simple) and to recieve (and returning) the values through PHP and Javascript. E.g. Website (PHP/Javascript) -> set a new motorspeed -> PHP passes the new speed to C Application -> C AP opens and writes the new speed onto the I2C Bus -> Motor executes -> returns ack -> Is this somehow, and not complicated possible? if the C program is written such that it can start and stop on every request rather than as a daemon, its as simple as shell_exec(). write your C app to take args over the cli and then pass them in through the call: something of that nature. -nathan This would be a nice and fast solution, but unfortunatelly, it's like that the C programm needs to surveilance the hardware all the time (controlling values,...) hence, it would run more as a "daemon". thx, tobias
Re: [PHP] Passing Values between C App and PHP
On Sun, Jun 21, 2009 at 3:25 PM, Tobias Krieger < tobias.krie...@teamfrednet.org> wrote: > Hi, > > I've recently written an eMail regarding I2C and PHP - since I haven't > found a nice solution yet, I'm considering writting the I2C part (opening > device, writing, reading,...) in C (that's simple) and to recieve (and > returning) the values through PHP and Javascript. > > E.g. Website (PHP/Javascript) -> set a new motorspeed -> PHP passes the new > speed to C Application -> C AP opens and writes the new speed onto the I2C > Bus -> Motor executes -> returns ack -> > > Is this somehow, and not complicated possible? if the C program is written such that it can start and stop on every request rather than as a daemon, its as simple as shell_exec(). write your C app to take args over the cli and then pass them in through the call: something of that nature. -nathan
Re: [PHP] passing values from dynamic form to another php page?
Quite rite. Well i have used this on my next page: global $HTTP_POST_VARS; $num_fields=count($HTTP_POST_VARS); while(list($key, $value) = each($HTTP_POST_VARS)) { echo "$key = $value"; /or whatever coding i want to do// } regards hope Jay Blanchard wrote: [snip] enctype="multipart/form-data" > // now i want to access the values from input fields on next page? can somebody give me idea how to pass all form field values to next page in this context?? [/snip] Look in the $_POST array (which matches the form method) on the next page. For example; print_r($_POST); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing values from dynamic form to another php page?
[snip] // now i want to access the values from input fields on next page? can somebody give me idea how to pass all form field values to next page in this context?? [/snip] Look in the $_POST array (which matches the form method) on the next page. For example; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values from a new window
Javascript. Simply just update ur fields at the parent window. On onUnload even of the popup do this self.opener.formName.fieldName.value=document.popupformName.popupfieldName.value; Your keywords to check in Javascript papers are parent_window, window_opener and Javascript DOM. If you're using Dreamweaver then ur blessed by having a Javascript at the palm of ur hand. HTH. On Fri, 05 Nov 2004 13:03:31 -0800, Todd Cary <[EMAIL PROTECTED]> wrote: > I have a button that creates a new window. The surfer may enter data in > the new window, and if he does, when the window is closed by the surfer, > can the information update fields on the original page - the page/window > from which the new window was created? > > I have seen instances where the surfer can open a new window to get > email addresses and these addresses appear in the first window. > > Todd > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- M.Saleh.E.G 97150-4779817 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values from a new window
On Fri, 05 Nov 2004 13:03:31 -0800, Todd Cary <[EMAIL PROTECTED]> wrote: > I have seen instances where the surfer can open a new window to get > email addresses and these addresses appear in the first window. Javascript. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values from a new window
That is usually done with Javascript, though if you've got a session running, you can update session variables, then use Javascript to refresh the source page. For the most part I'd recommend a purely Javascript solution, but in some cases Using session variables/cookies/database might make more sense. Chris Todd Cary wrote: I have a button that creates a new window. The surfer may enter data in the new window, and if he does, when the window is closed by the surfer, can the information update fields on the original page - the page/window from which the new window was created? I have seen instances where the surfer can open a new window to get email addresses and these addresses appear in the first window. Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing values to PHP
Try this: extract($_POST); extract -- Import variables into the current symbol table from an array All of my forms have worked without $_POST or $_GET. Is there a reason for inavailability of variables??? Its a good practice to use $_POST for security reasons. Vishal. -Original Message- From: Ciemny, Jessica [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 30, 2004 10:30 AM To: [EMAIL PROTECTED] Subject: [PHP] Passing values to PHP Hey every, I'm new to the group and to PHP (3 days now) and I would like to ask a question. I purchased a book on PHP a day or so ago and as I'm going through the book it comes to a point where it talks about passing html form values to PHP. So I type up the examples from the book, both the html file and the PHP file and I run it and I don't get anything when the PHP file is accessed. H puzzling! I don't get any errors at all, but the values just aren't coming across. The book says that I should be able to take the "name=xyz" value from the HTML form and just use it as a regular variable ($xyz) in the PHP file. But this doesn't work. After much digging on web pages and through email lists I found reference to something called the $_POST variable. This seems to be the only way that I can make the PHP file use the "name=xyz" values from the HTML file. So in the PHP file I would have to use the variable "$_POST[xyz]" to get the form value returned. Anyone have any ideas as to what's up. I hope its just something silly that I'm missing being a newby to PHP and all. I will include small versions of the file here for reference: HTML FILE - Please enter your name: PHP FILE (Doesn't Work) - PHP FILE (Does Work) - So I guess my question ultimately is, what are the different ways in which form data can be passed to a PHP script? Thanks you, Jessica -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values to PHP
Ciemny, Jessica wrote: Hey every, I'm new to the group and to PHP (3 days now) and I would like to ask a question. I purchased a book on PHP a day or so ago and as I'm going through the book it comes to a point where it talks about passing html form values to PHP. So I type up the examples from the book, both the html file and the PHP file and I run it and I don't get anything when the PHP file is accessed. H puzzling! I don't get any errors at all, but the values just aren't coming across. The book says that I should be able to take the "name=xyz" value from the HTML form and just use it as a regular variable ($xyz) in the PHP file. But this doesn't work. After much digging on web pages and through email lists I found reference to something called the $_POST variable. This seems to be the only way that I can make the PHP file use the "name=xyz" values from the HTML file. So in the PHP file I would have to use the variable "$_POST[xyz]" to get the form value returned. Anyone have any ideas as to what's up. I hope its just something silly that I'm missing being a newby to PHP and all. The problem here is that the book is written for a PHP setup where register_globals is assumed to be turned on. This can be a security risk, so as of PHP 4.2.x, register_globals has been turned off by default (before it was on by default). Register globals is a directive that tells PHP to automatically create variables from requested information (be it POST or GET). More information about why register_globals is a bad idea can be found at the following PHP manual page [ http://www.php.net/register_globals ] I will include small versions of the file here for reference: [ snipped ] So I guess my question ultimately is, what are the different ways in which form data can be passed to a PHP script? Data is transferred using forms in two methods. GET or POST. The difference between the two (the main difference) is that the data from a GET request is appended to the URL. Such a request would be : http://www.google.com/search?q=php+tutorials and data from a POST request is actually sent as part of the HTTP request (in the header), so its not viewable in the browser URL. PHP provides (since PHP version 4.2) two arrays, $_POST and $_GET for each of the above methods. There is also a third array, $_REQUEST which holds all information sent in the request. These arrays are called "superglobals" because they are available throughout your pages without any effort from your part. Each array consists of a key and a value. The key is whatever is the name attribute of your form value. An example : process.php : //Turn up error reporting //to the max level error_reporting(E_ALL); //Print out the contents //of the $_POST array //so we can see what it //contains. echo ""; print_r($_POST); echo ""; ?> When you run the above script with the associated form, you will see the format of the $_POST array. It will contain an element with the key "firstname" and the value will be whatever the user entered in that text box. It will also contain an element with the key "submit" whose value is "submit" (that's our submit button). Hopefully this helps, and welcome to PHP :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing values to PHP
[snip] Anyone have any ideas as to what's up. I hope its just something silly that I'm missing being a newby to PHP and all. [/snip] There is a feature in the php.ini called register_globals. If you look in your php.ini you will see that it is off by default and some of the books may have missed this as the default previously was on. You would be best to learn PHP with it off as most of the community does it that way for various reasons. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values dynamically
i guess, it would be better to use loops, if i understand your problem, the way it is. Nitin - Original Message - From: "Rashini Jayasinghe" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, October 17, 2003 3:12 PM Subject: [PHP] Passing values dynamically > Hi, > > I am getting a one column table as a result for a select statement. Now I > want to pass obtained values dynamically to invoke another query in a new > page. I tried to pass the values with sessions. But every time I get the > last value of the previous result. > Any suggestions as how I could pass the value that I click on the current > page ? (One of the row values in the one column table I got as the previous > result) > > Thank You. > > Rashini > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values dynamically
You need to create an array in the session and assign the values: $_SESSION['values']=array(); while( $v=/* get single value */ ) { $_SESSION['values'][]=$v; // notice the [] } Then on the other page loop the array. Rashini Jayasinghe wrote: Hi, I am getting a one column table as a result for a select statement. Now I want to pass obtained values dynamically to invoke another query in a new page. I tried to pass the values with sessions. But every time I get the last value of the previous result. Any suggestions as how I could pass the value that I click on the current page ? (One of the row values in the one column table I got as the previous result) Thank You. Rashini -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values from one page to another
--- murugesan <[EMAIL PROTECTED]> wrote: > Enter ... > > http://www.php.net/register_globals Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing Values between Pages : $_SESSION / $_GET
[snip] Let me clarify again. The $_GET Parameter was used to to transfer the name from the results page (with the tables etc) to a full-profile_1.php page. On the full_profile_1.php page the user is displayed a form with all the details about the company. On the same page there is a form where changes can be made to values of the fields. I am trying to pass the company name in this form as a POST Parameter. However the Update part of the full_profile.php page is not able to get this value. [/snip] Clearer now. Place the value in a hidden form field that can be passed along with the POST -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values between Pages : $_SESSION / $_GET
Thank you Jay for responding. Let me clarify again. The $_GET Parameter was used to to transfer the name from the results page (with the tables etc) to a full-profile_1.php page. On the full_profile_1.php page the user is displayed a form with all the details about the company. On the same page there is a form where changes can be made to values of the fields. I am trying to pass the company name in this form as a POST Parameter. However the Update part of the full_profile.php page is not able to get this value. The main point to remember is that full_profile_1.php does 2 things : 1.) Display all the fields of the company as a form which is editable 2.) Now if the user were to make changes in the values that were returned in the form above , the changes should be updated in the record. Now my problem is trying to transfer the name of the company from the 'form' to the update query. The way the logic on the full_profile_1.php is designed is as follows: if ($submit) { // This is after the user has been displayed all the fields of the record and he has made some changes and wanst to Update them // The Problem is how do I get the same name of the company in this loop. I have tried to pass the name as another $_POST Variable from the Form in the else part below, but when I try to access it over here. nothing comes. $temp1 = $_POST['temp']; // RETURNS EMPTY :( } else{ // here we get the name of the company as a $_GET Parameter from the previous page // display all the records of the selected company as a editable Form } Thanks again, and have a great weekend ! --Pushpinder On Friday, August 8, 2003, at 04:20 PM, Jay Blanchard wrote: [snip] My question here is " How do I get the name of the company that was passed to this script as a $_GET Parameter. I cannot use the $company because it is out of scope. [/snip] How about $_GET['company'] ? Or am I missing something? Have a pleasant day.
Re: [PHP] Passing Values between Pages : $_SESSION / $_GET
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Hello again, > > I would appreciate if someone could help me out with this one. > > Thanks again > > --Pushpinder > > > > > On Friday, August 8, 2003, at 11:46 AM, Pushpinder Singh Garcha wrote: > > > Hello All, > > > > I am using php and mysql in my application which allows users to > > search/query a database. The database is cast and has about 32 rows > > per record. When the user fires the query, the result is in the form > > of a table that contains only the 6 important rows of the entire > > record. Also there is a provision to allow the user to see the full > > record set by clicking on the link under the 'complete profile' > > contained in the table. (as shown below). The name of this script is > > lookup_results.php > > > > Here is the result for a companies in city = 'Charlotte' / Primary key > > of the table is the name of the company. > > --- > > --- > > - > > Company Name Main ContactCity Website > >E-Mail Complete > > Profile > > --- > > --- > > - > > PSG Pushpy Charlotte > > http://www.psg.com[EMAIL PROTECTED]--Link-- > > TFNA Napier Charlotte > > http://www.psg.com[EMAIL PROTECTED]--Link-- > > Micro Bates Charlotte > > http://www.psg.com [EMAIL PROTECTED]--Link-- > > CNN Garcha PSCharlotte > > http://www.psg.com [EMAIL PROTECTED]--Link-- > > --- > > --- > > - > > > > > > To see the complete profile of the company I use > > href=\"full_profile_1.php?name=".$row['company'] I don't see what your question is? -- Quod subigo farinam $email =~ s/oz$/au/o; A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing Values between Pages : $_SESSION / $_GET
[snip] My question here is " How do I get the name of the company that was passed to this script as a $_GET Parameter. I cannot use the $company because it is out of scope. [/snip] How about $_GET['company'] ? Or am I missing something? Have a pleasant day. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values between Pages : $_SESSION / $_GET
Hello Jay , I am attaching snippet of the Form Code that displays the results of the first query meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> "; ?> Complete Candidate Profile Logout Company Name > // END OF SNIPPET However when I try to access it in the if($submit) part as $_POST['temp'] I get nothing !!! Thanks in advance, --Pushpinder On Friday, August 8, 2003, at 04:57 PM, Jay Blanchard wrote: [snip] Let me clarify again. The $_GET Parameter was used to to transfer the name from the results page (with the tables etc) to a full-profile_1.php page. On the full_profile_1.php page the user is displayed a form with all the details about the company. On the same page there is a form where changes can be made to values of the fields. I am trying to pass the company name in this form as a POST Parameter. However the Update part of the full_profile.php page is not able to get this value. [/snip] Clearer now. Place the value in a hidden form field that can be passed along with the POST
Re: [PHP] Passing Values between Pages : $_SESSION / $_GET
Hello again, I would appreciate if someone could help me out with this one. Thanks again --Pushpinder On Friday, August 8, 2003, at 11:46 AM, Pushpinder Singh Garcha wrote: Hello All, I am using php and mysql in my application which allows users to search/query a database. The database is cast and has about 32 rows per record. When the user fires the query, the result is in the form of a table that contains only the 6 important rows of the entire record. Also there is a provision to allow the user to see the full record set by clicking on the link under the 'complete profile' contained in the table. (as shown below). The name of this script is lookup_results.php Here is the result for a companies in city = 'Charlotte' / Primary key of the table is the name of the company. --- --- - Company Name Main ContactCity Website E-Mail Complete Profile --- --- - PSG Pushpy Charlotte http://www.psg.com[EMAIL PROTECTED]--Link-- TFNA Napier Charlotte http://www.psg.com[EMAIL PROTECTED]--Link-- Micro Bates Charlotte http://www.psg.com [EMAIL PROTECTED]--Link-- CNN Garcha PSCharlotte http://www.psg.com [EMAIL PROTECTED]--Link-- --- --- - To see the complete profile of the company I use href=\"full_profile_1.php?name=".$row['company'] . So once we are on the full_profile_1.php, we can see all the contents of the record. Also we display a form where we can edit the results in place. The logic works like this. // full_profile_1.php LOGIC session_start(); if (isset($_SESSION['validuser'])) { if($submit) { update the changes that the user has made to the form My question here is " How do I get the name of the company that was passed to this script as a $_GET Parameter. I cannot use the $company because it is out of scope. The only other option would be to use $_SESSION['link'] i.e. Store the names of the companies in a session array. So now the array as per the example above would be {'PSG','TFNA', 'Micro', 'CNN' } . The way this will work is how do I get the index of the 'link' array that is applicable in this example. Here the name of the company would be $company = $_SESSION['link'][0]; If we had clicked the second row of the results table the name of the compnay would have been 'TFNA' i.e. $_SESSION['link'][1] and so on. How do I pass the index. ??? } else { $company = $_GET['name']; USE ANDdisplay all the rows of the record where company_name ='company' } } else { redirect the user to the ERROR Page } // end of pseudo- code Thanks in advance guys. I know this may sound a lil' vague , but I have tried to present the logic and the problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values back to form
Thanks so much for your time. These are great tips, thanks again. - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: "Daniel J. Rychlik" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, June 05, 2003 12:37 PM Subject: Re: [PHP] Passing values back to form > Hi Daniel, > > My advice is to use php sessions. You can register both the filled and > empty values in the session after processing them. Then you can header() > redirect normally with no fuss and extract the values from the session file > on the form page. > > And here's a tip. Set up some CSS in a switch() statement to highlight the > form fields that are left blank. This makes for a nice user interface, > esspecially on larger forms. > > Read up on sessions.. > http://www.php.net/manual/en/ref.session.php > > HTH, > Kevin Stone > > > - Original Message - > From: "Daniel J. Rychlik" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, June 05, 2003 10:31 AM > Subject: [PHP] Passing values back to form > > > Im new to PHP coming from a background in perl devlopement. I have a form > that a user can fill out. > > On submit the values are iterated over a foreach to check for empty(). If > the an emtyp $key is found then it passes an error string to my error > function. > > I have 2 php files, one that is the Form called profile.php and one that > processes the values from the form, called profileprocess.php. There are > multiple functions in profileprocess.php. When the header function is > called in the profileprocess.php it takes you back to the profile.php with > empty values in the fields. I was wandering if their is a way, (which Im > sure their is) to pass back all the data that was correctly entered back to > the form, and then a nice little message that displays the error of the data > that needs to be checked by the user. I could do this a number of ways, but > the key is not writing code that you dont have to. Its just smarter > programming. > > Any ideas, or functions I could read on in the rtFM manual is greatly > appreciated. > > I appreciate you looking at this problem... > Thanks in advance, > Daniel > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing values back to form
Hi Daniel, My advice is to use php sessions. You can register both the filled and empty values in the session after processing them. Then you can header() redirect normally with no fuss and extract the values from the session file on the form page. And here's a tip. Set up some CSS in a switch() statement to highlight the form fields that are left blank. This makes for a nice user interface, esspecially on larger forms. Read up on sessions.. http://www.php.net/manual/en/ref.session.php HTH, Kevin Stone - Original Message - From: "Daniel J. Rychlik" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 05, 2003 10:31 AM Subject: [PHP] Passing values back to form Im new to PHP coming from a background in perl devlopement. I have a form that a user can fill out. On submit the values are iterated over a foreach to check for empty(). If the an emtyp $key is found then it passes an error string to my error function. I have 2 php files, one that is the Form called profile.php and one that processes the values from the form, called profileprocess.php. There are multiple functions in profileprocess.php. When the header function is called in the profileprocess.php it takes you back to the profile.php with empty values in the fields. I was wandering if their is a way, (which Im sure their is) to pass back all the data that was correctly entered back to the form, and then a nice little message that displays the error of the data that needs to be checked by the user. I could do this a number of ways, but the key is not writing code that you dont have to. Its just smarter programming. Any ideas, or functions I could read on in the rtFM manual is greatly appreciated. I appreciate you looking at this problem... Thanks in advance, Daniel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing values from one script to another script
> I want to pass a value, which came from a HTML form, to another PHP > script. How can i do this? > > e.g.: $login - the value of this varriable is came from LOGIN.HTML to > LOGIN.PHP. How can i pass the value of $login from LOGIN.PHP to > PROCESS.PHP? The easiest way is with a session. Remember, each request is unique, so if you want to carry something over, you have to include it in the next request. This means adding it to the URL ($_GET) or adding it to a form ($_POST), adding it to a cookie ($_COOKIE), or putting it in the session ($_SESSION). ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing values from one script to another script
Either use session, cookies, or pass the value in URLs. Because it is login information, I would choose session or cookie Chinmoy Barua wrote: Hello everybody, I want to pass a value, which came from a HTML form, to another PHP script. How can i do this? e.g.: $login - the value of this varriable is came from LOGIN.HTML to LOGIN.PHP. How can i pass the value of $login from LOGIN.PHP to PROCESS.PHP? Thank you, Chinmoy - Do you Yahoo!? Yahoo! Web Hosting - establish your business online -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values to an image script
>On Thu, 6 Jun 2002, Anzak Wolf wrote: > > $h=20; > > $w=80; > > print ""; > > > > Now this is a much watered down version of what I'm doing, but the idea >is > > the same. I don't want to put the values I'm passing to the image in >the > > html code to be passed with a get. I'd like to be able to maybe pass >then > > in a POST format though I'm not sure how I can do that or if I can. The > > other idea I had was to start a session and register $h and $w then when >I > > start the images script I can connect to the session and get the values >form > > there though I would have to use Arrays so that I could keep data on >many > > diff. images. I could pass the array index to the image script which >would > > index all the array elements needed. The only down side I can see to >that > > is that I would have to serialize the array vars in order to maintain >them > > between sessions (index.php and image.php) and I would have a higher >over > > head on my session code which may impact preformance greatly. Anyone >have > > any ideas about this as in good idea bad idea, or other suggestions on >how > > to pass this data without letting the user see it. > >You don't want them to see it for which reason? > >1) It's highly confidential; or >2) It looks ugly; or >3) You don't want casual users messing with it...? > >If 3, just base64 encode the serialized array of data and most people will >leave it alone (it'll just look like a string of random letters and >numbers) > >Posting isn't that useful unless the image is going to show up on its own >in the web browser window. > >Sessions are okay, but once people start using the back button you are >going to have some weird side effects. > >miguel > > It's not confidental, but I don't want users figuring out my backend image code from it. While I'm not sure what they could do with it other than make images the way they want and display then for themselves I don't see any danger in it. I just don't like messy long URL lines. I'm already going to be giving the users a way to customize the site so they don't need to me messing with varibles passed to the image script. As for your comment about the back button I have come up with a section of code for my site that stops user for doing much with the back or reload button. I keep track of a link counter in a session var and then if they hit back or reload the link counter that gets sent in the post data is not equal to counter++ and so I redirect them to an error page that explains that the site does not allow the use of the back button or reload buttons. -Jim _ Join the worlds largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Values to an image script
On Thu, 6 Jun 2002, Anzak Wolf wrote: > $h=20; > $w=80; > print ""; > > Now this is a much watered down version of what I'm doing, but the idea is > the same. I don't want to put the values I'm passing to the image in the > html code to be passed with a get. I'd like to be able to maybe pass then > in a POST format though I'm not sure how I can do that or if I can. The > other idea I had was to start a session and register $h and $w then when I > start the images script I can connect to the session and get the values form > there though I would have to use Arrays so that I could keep data on many > diff. images. I could pass the array index to the image script which would > index all the array elements needed. The only down side I can see to that > is that I would have to serialize the array vars in order to maintain them > between sessions (index.php and image.php) and I would have a higher over > head on my session code which may impact preformance greatly. Anyone have > any ideas about this as in good idea bad idea, or other suggestions on how > to pass this data without letting the user see it. You don't want them to see it for which reason? 1) It's highly confidential; or 2) It looks ugly; or 3) You don't want casual users messing with it...? If 3, just base64 encode the serialized array of data and most people will leave it alone (it'll just look like a string of random letters and numbers) Posting isn't that useful unless the image is going to show up on its own in the web browser window. Sessions are okay, but once people start using the back button you are going to have some weird side effects. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing Values
show us code -Original Message- From: Sebastian A. [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 6:02 AM To: PHP General List (PHP.NET) Subject: [PHP] Passing Values Hello, Today I was working on an object that will create all of the columns and tables in my DataBase for my upcoming application. I however, did run into trouble. I am having problems because I cannot pass the name of the database from the form to the function that needs it. Everything is on the same page (sql_create.php), and the functions that gets the data (the form function) and the function that needs the Database name are both within an object. Does anyone have any ideas? I can post some code samples if it will help. Thanks in Advnace -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing values
Are you using the post form method to post this variable to the next page. The value $_POST['inp'] is not present or set...there is a null value there. You will need to set the value with a post inorder to access it with the predefined variable $_POST... Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: John Gurley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 6:43 AM To: [EMAIL PROTECTED] Subject: [PHP] passing values this is still not working for passing a value from one page to another: '; ?> When I look at the source this appears: which I take to mean that it does not know what $inp is. could it be something with my browser, or am I still doing something wrong (I wouldn't be a bit surprised) Thanks John _ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing values to a javascript variable
echo "" ."\n\tvar ndata = '".addslashes($data_data)."';" ."\n\tPutCode(ndata);" ."\n"; Try that. Chris "TunkeyMicket" Watford TunkeyMicket Productions www.tunkeymicket.com - Original Message - From: "Romulo Roberto Pereira" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 21, 2001 3:38 PM Subject: [PHP] passing values to a javascript variable > Hello! > > The following give me: unterminated string constant (this is a javascript > error) > > when I execute the following: > >while ($row = mysql_fetch_array ($data_query_action)) { > $data_data = $row["data_data"]; >} > echo "\n var > ndata=\"".addslashes($data_data)."\";\nPutCode (ndata);\n"; > > Ideas? Please I need help. > > Thank you, > > Rom > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] passing values to a javascript variable
On Thu, 21 Jun 2001, Romulo Roberto Pereira wrote: > Hello! > > The following give me: unterminated string constant (this is a javascript > error) > > when I execute the following: > >while ($row = mysql_fetch_array ($data_query_action)) { > $data_data = $row["data_data"]; >} >echo "\n var > ndata=\"".addslashes($data_data)."\";\nPutCode (ndata);\n"; > > Ideas? Please I need help. > > Thank you, > This is usually a problem where a string literal is spanning thru several lines. Remember, in JavaScript one statement ends either with a semi-colon or a newline '\n'. You should do str_replace("\n", '\n', $data_data) in there before doing addslashes(). Believe it or not, thats the error. Joao -- João Prado Maia <[EMAIL PROTECTED]> http://phpbrasil.com - php com um jeitinho brasileiro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Passing values from ASP to PHP
I'm no ASP guru (never touched it actually), but...it seems as if this will add an extra "&" on the end of the url. myscript.php?one=blue&two=red&three=yellow& ^ -Original Message- From: Opec Kemp [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 01, 2001 9:47 AM To: [EMAIL PROTECTED] Cc: PHP General List Subject: RE: [PHP] Passing values from ASP to PHP Hi, To enumerate the key/value in ASP from the form you'd do this <% dim element dim objForm dim strURL '/* We're creating an object so that it won't matter which ' * HTTP method the previous form uses. ' */ If LCase(Server.Request("HTTP_METHOD")) = "post" Then Set objForm = Request.Form Else Set objForm = Request.QueryString End If strURL = "myscript.php?" '/* Now step through the form For each element in objForm '/* Key Name is in the "element" var ' * Value of the key is in the objForm(element) ' * Now build the Redirect string ' */ strURL = strURL & Server.URLEncode(element) & "="& Server.URLEncode(objForm(element)) & "&" Next '/* Now redirect Response.Redirect(strURL) %> That should do it. > > I've been given a project that I want to use PHP with, but > > unfortunately there are unchangable hard-coded values that point clients to an ASP > > script residing on our server. Here's what I want to do, and I don't > > really know how to do it: > > > > I want to pass all the key/value pairs that are passed to the > > ASP script > > to a PHP script. I can get values with Request.Form("key_name"), but > > that takes hard-coding the name of the key. > > > > So if the following is passed to the ASP script: > > one=blue&two=red&three=yellow > > > > Then I would want to redirect to > > myscript.php?one=blue&two=red&three=yellow > > > > How do I go about walking through all the key/values that > > have been passed > > in ASP? I really don't want to have to learn this ugly language.. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Passing values from ASP to PHP
Hi, To enumerate the key/value in ASP from the form you'd do this <% dim element dim objForm dim strURL '/* We're creating an object so that it won't matter which ' * HTTP method the previous form uses. ' */ If LCase(Server.Request("HTTP_METHOD")) = "post" Then Set objForm = Request.Form Else Set objForm = Request.QueryString End If strURL = "myscript.php?" '/* Now step through the form For each element in objForm '/* Key Name is in the "element" var ' * Value of the key is in the objForm(element) ' * Now build the Redirect string ' */ strURL = strURL & Server.URLEncode(element) & "="& Server.URLEncode(objForm(element)) & "&" Next '/* Now redirect Response.Redirect(strURL) %> That should do it. > > I've been given a project that I want to use PHP with, but > > unfortunately there are unchangable hard-coded values that point clients to an ASP > > script residing on our server. Here's what I want to do, and I don't > > really know how to do it: > > > > I want to pass all the key/value pairs that are passed to the > > ASP script > > to a PHP script. I can get values with Request.Form("key_name"), but > > that takes hard-coding the name of the key. > > > > So if the following is passed to the ASP script: > > one=blue&two=red&three=yellow > > > > Then I would want to redirect to > > myscript.php?one=blue&two=red&three=yellow > > > > How do I go about walking through all the key/values that > > have been passed > > in ASP? I really don't want to have to learn this ugly language.. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Passing values from ASP to PHP
Well, if it's a query string it's easy... In the ASP page you do: <% Response.Redirect("myscript.php?" & Request.ServerVariables("QUERY_STRING")) %> If it's posted form data do this: <% Dim Querystring Querystring = "" For each Item in Request.Form if Querystring = "" Then Querystring = Item & "=" & Server.UrlEncode(Request.Form(Item)) Else Querystring = Querystring & "&" & Item & "=" & Server.UrlEncode(Request.Form(Item)) ' the above line isn't supposed to wrap End If Next Response.Redirect("myscript.php?" & Querystring) %> On 2/28/01 4:08 PM this was written: > I've been given a project that I want to use PHP with, but unfortunately > there are unchangable hard-coded values that point clients to an ASP > script residing on our server. Here's what I want to do, and I don't > really know how to do it: > > I want to pass all the key/value pairs that are passed to the ASP script > to a PHP script. I can get values with Request.Form("key_name"), but > that takes hard-coding the name of the key. > > So if the following is passed to the ASP script: > one=blue&two=red&three=yellow > > Then I would want to redirect to > myscript.php?one=blue&two=red&three=yellow > > How do I go about walking through all the key/values that have been passed > in ASP? I really don't want to have to learn this ugly language.. -- Thomas Deliduka IT Manager - New Eve Media The Solution To Your Internet Angst http://www.neweve.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]