I am quite new to php so please bear with me if you think the answer is obvious.
Problem/question: I have noticed when some websites process forms the tag contains action='/aaa/aa/' instead of action='/aaa/aa.php'.
How does this work? This leads to the next part of the question, how to clear the postdata so that the next window if refreshed will not resend and the url will not show '/aaa/aa.php'
Currently using javascript: I use javascript and php to get round this, but with accessiblity issues for my site, i cannot always rely on javascript. Code:
Action= ???
I can't find the answer!! I want to select a page from a "select" list. Click Submit and go to that page. Below is my code. The "???" is what I can't figure out.
<form action="???">
Select a month
<select
name="???" size="1">
<option selected value="">Select Area to Update</option>
<option value="<a href=Updatevent.php">Update Events</a></option>
<option value="<a href=UpdateCustomer.php">Update Customer</a></option>
<option value="<a href=AddCustomer.php">Add Customer</a></option>
</select></tr><tr>
<INPUT TYPE="submit" NAME="Update" VALUE="Submit">
</form></TABLE>
?action=action
if someone could tell me the layout of the ?action=action function. I cant seem to get it right. I have a form, the action of this form is ?action=action
does it go something like:
<?php
if action==action {
submitted form
} else {
default page
}
?>
$var->ACTION();
What is this called?
$var->ACTION();
I see this a lot, and I'm not sure what it means or if there is a name for what it's doing. I'd like to learn about this.
Index.php?action=1 Etc
just wondering how i could make a php page which has say an output like index.php?action=1 all it has to do is goto another webpage - so if i had URL then the user is taken to another page and so on for index.php?action=2 / index.php?action=3 / etc
Variable Action
I want to call a different php script depending on if the user clicks
the Chart button or the Play button. Is this possible?
LoadModule Vs. Action
a simple question regarding ways of loading php as a dll or an exe file
in httpd?
What is the difference of loading php as LoadModule php5_module
"C:phpphp5apache2_2.dll" or Action application/x-httpd-php
"/php/php-cgi.exe" or Action application/x-httpd-php "/php/php.exe".
Either way, what is the most preferable way and why?
Two Action In A Form?
can i put two actions in a form so that when i click the "submit" button, the information will be sent to both the database and my email account?
can i put two actions in a form so that when i click the "submit" button, the information will be sent to both the database and my email account?
Action And Header
I have used the action= statement to send the form to a new page which
can get the posted variables.
I have used the header("Location: foo.php) statement after testing on
the submit with isset.
What I want to know is if they can be combined. That is, test first
with the isset, and if no errors go to the action call. Simply going
with the header call doesn't seem to send the form variables.
I have used the action= statement to send the form to a new page which
can get the posted variables.
I have used the header("Location: foo.php) statement after testing on
the submit with isset.
What I want to know is if they can be combined. That is, test first
with the isset, and if no errors go to the action call. Simply going
with the header call doesn't seem to send the form variables.
Action Link
Does anyone have a solution for this problem:
- I would like a PHP script to execute an action before a user clicks
on a link (updating the value of a variable, for instance).
Is there an easy way to do this?
If() Action Within Print()..?
I'm trying to do something like this:
<?php
foreach($apples as $key => $value){
print("<td class=<?php if ($myvar==$key){print (class1);} else {print
(class2);} ?>>$value</td>");
}
?>
Hopefully, you can see what I'm trying to do, I've left out all the ' " '
etc. Obviously the syntax isn't right at all, how exactly do I achieve
putting an if() action with a print()? Is it even possible?
The Power Of ACTIONDoes anyone have a solution for this problem:
- I would like a PHP script to execute an action before a user clicks
on a link (updating the value of a variable, for instance).
Is there an easy way to do this?
If() Action Within Print()..?
I'm trying to do something like this:
<?php
foreach($apples as $key => $value){
print("<td class=<?php if ($myvar==$key){print (class1);} else {print
(class2);} ?>>$value</td>");
}
?>
Hopefully, you can see what I'm trying to do, I've left out all the ' " '
etc. Obviously the syntax isn't right at all, how exactly do I achieve
putting an if() action with a print()? Is it even possible?
how much power does <form ACTION= > have? is it only for sending the form somewere? or can i use that to acess a server? like i have a table of variable items, i check the ones i want and click my submit button, can i use the action sub tag to access mysql database and input them in there?
Selected Box Action
how to set the respond to action when user choose an option inside a <select></select> box? eg. when user select an option in the <select> box then php search for data inside mysql and then display the required data on the <input type=text>.
Post With No Action
I want to be able to pull values out of input boxes without having to post. Can I do this? I want to do this in PHP. Javascript Code:
<script>
myvariable = document.myform.inputname.value
</script>
I want to try and save the data in a form without having to redirect... similiar to the save now button in gmail.
Form Action
I have page called contracts.php form for selecting arrival date and departure date, after selecting those dates I want to pass the date values to a new window/iframe called price.php
where I can enter total price, balance, numdays..etc in that iframe again when I click on submit/close button in the new window/iframe it has to come back to contracts.php page with those entered values.
a form i want to include the Iframe so the page wont go into another window and on top of that i need to include the action , this is the original code
<form action="register.php?action=register" method="post">
now i tried changing it so it can stay in my regualr .php page so i did this
<form action="thegold.php?page=user/register" action="register" method="post">
heres the code that starts up the register PHP Code:
<?php
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
include("config.php");
if($action == "register")
{
and i am doing a user system thing so i need the action to be registed so when the person signs up he actually registers into the thing and i want the person to also be able to be in the same page.
How To Run An Action Script
how I run a paypal action script and than an sql insert from the same form. The form is basically as follows:
<?php
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" target ="paypal">
<input type="image" src="http://images.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
?>
The sql is:
$query = "INSERT INTO downloads (user_name, item_name, total_downloads) VALUES('$user_name', '$item_name', '$total_downloads')";
Form Action
I have an html form that sends data to a mySQL database. What I would also like is for the data to be e-mailed to me as well as going to the database. Here is my code:
<form action="../manchester/form.php" method="post"
name="form1" class="frm_addlisting" id="form1">
So that gets it to my database ok.
I want it to go to ../formmail.php as well so it I get an e-mail each time a user posts to the database.
Form Action?
Is it possable for an HTML form to have more than 1 action? I need it to forward to another page, and to sent an e-mail with form data.
<form name="products" enctype="text/plain" method="post" action="mailto:me@mymail.co.za?subject=My Subject? page2.php">
This method doesn't work.
Place Various PHP Action
I have this script, it works outside the function, no probs with it BUT I need to place the output of the function in one string in order to return in how do I do it?
$input = array('apple', 'orange', 'monkey', 'potato', 'cheese', 'badger', 'turnip');
$cols = 2;
function table_columns($input, $cols) {
[color=red]
$i=0;
echo = '<table border=1>
<tr>';
foreach ($input as $in){
$i++;
echo = '<td>'.$in.'</td>';
if($i==$cols){
echo = '</tr><tr>';
$i=0;
}
}
echo = '</tr><table>';[/color]
the bits in red should be placed in a variable called output
Does anyone know if I can run a function when the link is click by writing something similar to that bellow ?
<a href="" target="_blank" onClick="<? add_product_category(); ?>" >add
Category</a>
This line doesn't do what I want. What I want is to click the link and to open a new window which will have a form to add a Category.
If ($action==members
On my website I have a code like this where if $thispage='test'; then it would echo in the page title "(Ti|test".
I have this for index.php
$action = $_GET['action'];
if ($action==NULL){
$thispage="Homepage";
}
Which works fine.
but say for
?action=members
this should work right?
$action = $_GET['action'];
if ($action==members){
$thispage="Members";
}
But all it outputs in page title is nothing like this: "(Ti|"
Advanced E-mail Action.
I want to include a reference number from a table in an e-mail.
Would I just query the database and have this code, PHP Code:
Knowing The Form Action
On my website I have a code like this where if $thispage='test'; then it would echo in the page title "(Ti|test".
I have this for index.php
$action = $_GET['action'];
if ($action==NULL){
$thispage="Homepage";
}
Which works fine.
but say for
?action=members
this should work right?
$action = $_GET['action'];
if ($action==members){
$thispage="Members";
}
But all it outputs in page title is nothing like this: "(Ti|"
Advanced E-mail Action.
I want to include a reference number from a table in an e-mail.
Would I just query the database and have this code, PHP Code:
Knowing The Form Action
Is there a way to know if the page is:
- directly called from the browser
- called by the submit button pressed in POST mode
- called by the submit button pressed in GET mode
Php Variable In The Form Action
i have this in my intro.php form. Code: <form action="intro2.php" method="post" target="main"> is there a way i can assign a variable to take the name of the script, and put a two on it....then i can put that variable in place of the intro2.php?
I have a lot of these files, and when it comes time to replace all those intro2.php's, its gonna be a pain in the neck.
i was just wondering if there was a way to execute a previously defined function as the action="foo()" of a form.
Action Call Within Script
Any idea on how to call another script or action when original php script has executed?
How Do I Run More Than 1 Action Script From A Form?
I need to execute an sql query, then a paypal script from the same form. How do edit the code below to do this?
<?php
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" target ="paypal">
</form>
?>
My action file which is a php3 file is being downloaded instead of being processed. I have put in apache.conf file the undermentioned which I think should be ok, but still it does not happen.
ScriptAlias /cgi-bin/ "C:/apache/Apache/cgi-bin/"
ScriptAlias /php4/ "c:/php4/"
ScriptAlias /php/ "c:/php4/"
ScriptAlias /php3/ "c:/php4/"
ScriptAlias /rakesh/ "c:/php4/"
Variable Passing On A Php_self Action
i need a database id to pass it along on a few ´php pages, but i know how to do that only if the action of the page is directed to that next page (with hidden fields).
but now i got this php script that executes on the same page (form action is php_self)and in the execution line it has a header("Location: whateveer.php"); as a redirect after a condition has been met. how do i pass the variable on to that page?
File Upload Action To Iframei need a database id to pass it along on a few ´php pages, but i know how to do that only if the action of the page is directed to that next page (with hidden fields).
but now i got this php script that executes on the same page (form action is php_self)and in the execution line it has a header("Location: whateveer.php"); as a redirect after a condition has been met. how do i pass the variable on to that page?
I have tried uploading a file using the code as
//--------------------------------------------------------
// Main File
<form action="importaction.php" enctype="multipart/form-data"
method="post" target="targetupload">
<input type="file" name="fileimpcsv" id="fileimpcsv">
<input type="submit" name="subfileimpcsv" id="subfileimpcsv"
value="Import">
</form>
<iframe id='targetupload' name='targetupload' scrolling="auto"
frameborder="0" height="0"
src='ifimportaction.php'></iframe>
//--------------------------------------------------------
In the file ifimportaction.php, there is the code to get the POST,
FILES vars and upload the file.
And show the javascript alert after the file is uploaded. (Alert
message at the end of the file ifimportaction.php)
It's working perfectly for Firefox (tested in v2.0). But for IE (v6),
it's not working.
After I click the submit button, it's stay there only. If I remove all
the code from the ifimportaction.php and only print time(), (after
changing targetupload height to say 50), there is no change in the
values being displayed i.e., action is not going to that frame.
How can I upload the file in IE, so that page is not reloaded.
Submit Form With Variable For Action?
So, i've got a form that is very simple. It hold three elements:
username, password, and domain. The goal here is to have the form
submit the login to an administrative section depending on which domain
someone has chosen.
For instance, let's say we have three administrative sites, that all
have different URLs, but we want this one form to handle logging into
any of them. So, the form itself needs to have a dynamic action
element.
Here's an example:
Code:
<form action="http://www.mysite.com/admin/index.php" method="post"
name="login" id="login" >
<input name="usrname" type="text">
<input name="pass" type="password">
<input name="domain" type="text">
<input name="submit" type="submit" value="Login">
</form>
How Can I Pick All Checked Value In Action Page?So, i've got a form that is very simple. It hold three elements:
username, password, and domain. The goal here is to have the form
submit the login to an administrative section depending on which domain
someone has chosen.
For instance, let's say we have three administrative sites, that all
have different URLs, but we want this one form to handle logging into
any of them. So, the form itself needs to have a dynamic action
element.
Here's an example:
Code:
<form action="http://www.mysite.com/admin/index.php" method="post"
name="login" id="login" >
<input name="usrname" type="text">
<input name="pass" type="password">
<input name="domain" type="text">
<input name="submit" type="submit" value="Login">
</form>
I have a dynamic category list, I have printed those list with check box in the form. I have to check those boxes and submit. How can I pick all checked value in action page? Right now only one value passing from several check boxes while several check boxes checked. Code:
Performing An Action Upon GET Autochange Dropdown
Ive got the following drop down menu and I want to perform an action every time someone uses the dropdown. How Can I determine when it has been used? Normally I would pass in a mode but because its GET, I cant and if i change it to POST, it doesnt work how I want it to? Code:
Ive got the following drop down menu and I want to perform an action every time someone uses the dropdown. How Can I determine when it has been used? Normally I would pass in a mode but because its GET, I cant and if i change it to POST, it doesnt work how I want it to? Code:
Getting Data From Address Bar Into Form Action.
Here is the problem...i have a game where a users id and encrypted password are stored in the address bar on every page of the game.
e.g. main.php?P=bank&uid=15&password=faspmi9r329m2d324sd
now i have a problem when trying to link to a page through a form while still keeping these variables in the link
to be more specific i have a form for a user to deposit gold into their bank
upon entering a value in the input box and clicking either deposit or withdraw the form is to reload the same page where the proper if(isset($_POST command will take over and do the correct job.
The only problem is if i use a $_SERVER['PHP_SELF'] as the action for the form when it reads back on its self again it doesnt include the uid or password...it simply is reloading main.php
...my question is....
how do i get these variables sent back through the form button so the page will reload with the users information still there?
Here is the problem...i have a game where a users id and encrypted password are stored in the address bar on every page of the game.
e.g. main.php?P=bank&uid=15&password=faspmi9r329m2d324sd
now i have a problem when trying to link to a page through a form while still keeping these variables in the link
to be more specific i have a form for a user to deposit gold into their bank
upon entering a value in the input box and clicking either deposit or withdraw the form is to reload the same page where the proper if(isset($_POST command will take over and do the correct job.
The only problem is if i use a $_SERVER['PHP_SELF'] as the action for the form when it reads back on its self again it doesnt include the uid or password...it simply is reloading main.php
...my question is....
how do i get these variables sent back through the form button so the page will reload with the users information still there?
Form Action A Javascript Function
want my form to perform the same js function which is performed when the calculate button is clicked when the user hits enter instead of clicking on the calculate button. I tried the following but it doesn't work.
<form name="form1" onSubmit="loader('validate', qty.value,company.value);">
<label class="left">Name Of Company : </label>
<select name="company" onChange = "callAjax(this.value);";>
<option selected>- -Select a company- -</option>
<? $query="SELECT * FROM listedcomp ORDER BY company";
$result = mysql_query($query);
$num = mysql_numrows($result);
for ($i = 0; $i < $num;) {
$row = mysql_fetch_assoc($result); ...
Can't Execute Form Action Files !
PHP installed: version 5.0.5 My example:
index.html:
<form action=service.php method=POST>
<INPUT TYPE=Submit VALUE="Send">
</form>
service.php:
<HTML>
<BODY>
HTML Code was executed
<BR />
<? echo "PHP Code was executed" ?>
</BODY>
</HTML>
Have this problem:
When I run only the service.php, both html/php code is working.
But when I start with index.html in which the code is calling service.php after submit button click, whole the code in service.php is ignored and only blank page will appear.
Then how can I get inputs from users into my php code?
Maybe I've installed PHP (5.0.5) badly? But where can I make a mistake, however the installation is trivial, isn't it?
want my form to perform the same js function which is performed when the calculate button is clicked when the user hits enter instead of clicking on the calculate button. I tried the following but it doesn't work.
<form name="form1" onSubmit="loader('validate', qty.value,company.value);">
<label class="left">Name Of Company : </label>
<select name="company" onChange = "callAjax(this.value);";>
<option selected>- -Select a company- -</option>
<? $query="SELECT * FROM listedcomp ORDER BY company";
$result = mysql_query($query);
$num = mysql_numrows($result);
for ($i = 0; $i < $num;) {
$row = mysql_fetch_assoc($result); ...
Can't Execute Form Action Files !
PHP installed: version 5.0.5 My example:
index.html:
<form action=service.php method=POST>
<INPUT TYPE=Submit VALUE="Send">
</form>
service.php:
<HTML>
<BODY>
HTML Code was executed
<BR />
<? echo "PHP Code was executed" ?>
</BODY>
</HTML>
Have this problem:
When I run only the service.php, both html/php code is working.
But when I start with index.html in which the code is calling service.php after submit button click, whole the code in service.php is ignored and only blank page will appear.
Then how can I get inputs from users into my php code?
Maybe I've installed PHP (5.0.5) badly? But where can I make a mistake, however the installation is trivial, isn't it?
PHP And Frame Updates From Form Submit Action
I have created a page with two frames on it. The main frame contains a simple form that collects a username and password.
The form code is as shown below :-
<form method = "post" action = "getname.php">
Login Name : <input type="text" name="login_name"
size=12><br><br>
Password : <input type="text" name="passw" size=14>
<input type = "submit" name="submit" value = "Login" >
</form>
The php function getname assignes the value of "login_name" to a usable variable for later use.
Here's the problem, After the form's submit button is pressed I want update the contents of the second frame automatically, I also want it to contain the value for the login name entered on the form.
Is there a way of automatically updating the second form so that I can fill it with dynamic contect?
Form Action To Same File Opens New Window
Two questions late at night and going stir crazy. Anybody who takes pity on
me will have my undying gratitude and a virtual bottle of beer.
I've tried to look them both up on the php.net, and elsewhere, but without
success.
1. Am writing a php program which checks entries in a form on a previous
page. It then asks for any empty fields to be filled, and submits the
resulting form back to itself to check it again.
In other words the file "checkblank.php" includes this line within the php:
echo "<form target="checkblank.php" method="post">";
When the form is submitted it opens in a new window (in FireFox). In Firefox
it is not a disaster as the variables and arrays are not lost, and the
program works, but popups are not something I like. In IE the whole thing
collapses in a heap as the variables appear not to be passed to the new
window. Needless to say, the vast majority of users will have IE. Is there a
reason I'm unaware of, and can it be stopped easily?
2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate the
array into a whole lot of variables, as it's a big array.
I have created a page with two frames on it. The main frame contains a simple form that collects a username and password.
The form code is as shown below :-
<form method = "post" action = "getname.php">
Login Name : <input type="text" name="login_name"
size=12><br><br>
Password : <input type="text" name="passw" size=14>
<input type = "submit" name="submit" value = "Login" >
</form>
The php function getname assignes the value of "login_name" to a usable variable for later use.
Here's the problem, After the form's submit button is pressed I want update the contents of the second frame automatically, I also want it to contain the value for the login name entered on the form.
Is there a way of automatically updating the second form so that I can fill it with dynamic contect?
Form Action To Same File Opens New Window
Two questions late at night and going stir crazy. Anybody who takes pity on
me will have my undying gratitude and a virtual bottle of beer.
I've tried to look them both up on the php.net, and elsewhere, but without
success.
1. Am writing a php program which checks entries in a form on a previous
page. It then asks for any empty fields to be filled, and submits the
resulting form back to itself to check it again.
In other words the file "checkblank.php" includes this line within the php:
echo "<form target="checkblank.php" method="post">";
When the form is submitted it opens in a new window (in FireFox). In Firefox
it is not a disaster as the variables and arrays are not lost, and the
program works, but popups are not something I like. In IE the whole thing
collapses in a heap as the variables appear not to be passed to the new
window. Needless to say, the vast majority of users will have IE. Is there a
reason I'm unaware of, and can it be stopped easily?
2. Can anybody suggest a quick and easy way to strip arrays? stip_tags is
fine with variables, but converts arrays to variables. I'd like to use it
for the sake of security though. I don't particularly want to translate the
array into a whole lot of variables, as it's a big array.
Proper Action For A Page From A Database That Doesn't Exist.
What is the proper action to take when a user accesses a page from a database that doesn't exist.
For example:
User accesses
http://www.example.com/parts/pn12345.html
which translates to
http://www.example.com/parts/lookup.php?ID=12345
where part number 12345 is not in the database.
I would think 404 would be the proper response, but I need to redirect to another page. I have a parts index that I want the user taken to without having to click on anything.
Passing Credentials In A Form And Perform ActionWhat is the proper action to take when a user accesses a page from a database that doesn't exist.
For example:
User accesses
http://www.example.com/parts/pn12345.html
which translates to
http://www.example.com/parts/lookup.php?ID=12345
where part number 12345 is not in the database.
I would think 404 would be the proper response, but I need to redirect to another page. I have a parts index that I want the user taken to without having to click on anything.
All, I want to create a script that performs the following:
1. Access a page and submits authentication credentials (www.example.com/login.html)
2. Once authenticated, grab values of a form (www.example.com/logs.html)
I just need to be stepped through the thought process. Unfortunately, I can't use cURL because the main page doesn't request for authentication. Instead, it's an authentication form/page. Or perhaps I can still use cURL, but not use its auth mechanism of CURLOPT_USERPWD.
Here's the form parameters that must be submitted:
<label>Username:</label>
<input type="text" size="14" name="username" value="User" />
<label>Password:</label>
<input type="password" size="14" name="password" value="" />
<input type="submit" value="Login" />
Action Based On Button Pressed In Confirm Box
I have developed a mysql database for maintaining info abt my machines.I want to give a confirm box if someone presses delete button.If the user presses ok,i proceed to delete the record otherwise I retain the same record.Can anyone help me out with this?Here's my code(sorry if it's long): Code:
Stopping <a> From Loading New Page But Still Performing Onclick Action
I want to use hyperlinks to 'load' content by changing the display of
div tags. the problem i have is that unless i specify a href the anchor
does not change the mouse pointer on hover even if display is set to
block. it only look changes when there is a href there. but if i have a
href there then when i click it will load the page, which i dont want.
how can i get the anchor to look like a proper link where the users
pointer changes on hover (in firefox) but a page does not get refreshed
onclick only the onclick function gets loaded.
Adding Additonal Values From Forms To The Top Of The Action Page
I have form on multiple pages with one text input and two hidden fields.
When the user submits the form, they are taken to:
/actionpage.php?input=x&hidden1=y&hidden2=z
On the action page there is a third party JavaScript that I can not change that requires the two hidden fields.
I am wondering if I can setup something at the top of the action page that establishes the two hidden fields, allowing me to take them off from all my pages while still allowing the third party script to work.
Remove Record Id From Static Name In Form Action Script
I am creating a page that has multiple dynamic forms, two of my form elements are using a static name and the record id (this is needed for another reason.) I need to remove the record id, so my post in my update script will be:
$date_start=$_POST['start'];
$date_finish=$_POST['finish'];
<input type="text" name="start<?php echo $task_number; ?>" value="<? echo $date_start; ?>">
and
<input type="text" name="finish<?php echo $task_number; ?>" value="<? echo date_finish; ?>">
In the update script I can access the input value by using the variable ${'start'.$task_number}
Is there a way to remove $task_number from it so it posts as 'start' and 'finish'?
Do I somehow need to provide the form action script a list of task_numbers via an array serialized and urlencoded via a hidden field to decode and unserialize? If so, does anyone know how? If not, does anyone know how I can do this?
<form Action=<?$_SERVER['PHP_SELF']>? Name=''> Is This Good Practice
I read on one page in form handling, that its good practice to user <form action=<?$_SERVER['PHP_SELF']?>> and i also read on another page, that this is the easiet way to get hacked.....which one is correct
Form Action = <?=$_SERVER['PHP_SELF']?> - Stopped WorkingI read on one page in form handling, that its good practice to user <form action=<?$_SERVER['PHP_SELF']?>> and i also read on another page, that this is the easiet way to get hacked.....which one is correct
My form action code to submit values to itself have stopped working using the code
form action = <?=$_SERVER['PHP_SELF']?>
This code used to work
My web host recently told me they enabled phpsuexec option in apache which apparently needs me to CHMOD my PHP page to 750 and the directory to 755. (I don't know what this means but know how to CHMOD files). I have CHMODed the files this but my PHP page doesn't work with those settings, so I set them back.
Bizarre Phantom Bug (Calling A PHP Script From An Apache "Action" Directive)
I am using an "Action" directive in my Apache configuration to map a
certain file type (by means of AddType and AddHandler) to a PHP script.
I wasn't sure if this would work, since the Apache docs say the Action
directive is for mapping a handler name to a CGI script in particular.
But it seemed to work at first.
Then a mysterious bug arose: Sometimes it works perfectly, and other
times the output is a totally blank page. It seems that if I haven't
viewed a page for a while, it chooses to do one of these at random
(though it is blank more often than not), and then it persists in the
same behaviour until I reload it many times. (That is, usually a page
appearing blank will eventually display if I reload it many times;
however, only rarely will a correctly-displayed page regress to
appearing blank after reloads.) Checking with `curl -i', it would
appear to a client program that the request was perfectly successful:
all the headers are there (with the correct content-type), it has an
HTTP/1.1 200 OK line, and so on (and there's nothing unusual in the
server's access or error logs), except Content-length is 0, and there
is indeed no content at all after the two newlines.
WTF?? Since when do computers behave non-deterministically? I should
hope, if a program is not going to behave correctly, that it at least
do so predictably and consistently. That would make debugging it much
easier. But what am I to make of this Schrodinger's Bug? How do I even
approach the debugging process?
(Also, if anyone could suggest a workaround, an alternate method of
having a PHP script handle files with a certain extension, then that
would be just as welcome. Though I'd like to stay within mod_php,
avoiding a CGI-based technique, because I'd prefer to not start a
process every time these pages are requested.)
I am using an "Action" directive in my Apache configuration to map a
certain file type (by means of AddType and AddHandler) to a PHP script.
I wasn't sure if this would work, since the Apache docs say the Action
directive is for mapping a handler name to a CGI script in particular.
But it seemed to work at first.
Then a mysterious bug arose: Sometimes it works perfectly, and other
times the output is a totally blank page. It seems that if I haven't
viewed a page for a while, it chooses to do one of these at random
(though it is blank more often than not), and then it persists in the
same behaviour until I reload it many times. (That is, usually a page
appearing blank will eventually display if I reload it many times;
however, only rarely will a correctly-displayed page regress to
appearing blank after reloads.) Checking with `curl -i', it would
appear to a client program that the request was perfectly successful:
all the headers are there (with the correct content-type), it has an
HTTP/1.1 200 OK line, and so on (and there's nothing unusual in the
server's access or error logs), except Content-length is 0, and there
is indeed no content at all after the two newlines.
WTF?? Since when do computers behave non-deterministically? I should
hope, if a program is not going to behave correctly, that it at least
do so predictably and consistently. That would make debugging it much
easier. But what am I to make of this Schrodinger's Bug? How do I even
approach the debugging process?
(Also, if anyone could suggest a workaround, an alternate method of
having a PHP script handle files with a certain extension, then that
would be just as welcome. Though I'd like to stay within mod_php,
avoiding a CGI-based technique, because I'd prefer to not start a
process every time these pages are requested.)
Form Processing: Change The "action=" Based On Pull Down Menu
I have an html form for that uses username and password to login to a
specific area of the website. The "area" the user wants to go to is
based on a pull down menu. Becasue the user/password info is in
differnet databases, how can I call different validation scripts based
on this input ?
See below please. Somethinglike this:
form.html:
<form name="loginform" method="post" action="login.php">
<select name="loginform">
<option value="one">Section 1</option>
<option value="two">Section 2</option>
</select>
login.php:
@extract($_POST);
if($_POST[loginform] == "one") {
echo "action = /forums/scc/dispatch.cgi/_admin/AVFLogin"
NAME="LoginForm" >
echo "<input type=hidden name="autologin" value="1">
";
echo "<input type=hidden name="formstyle" value="standard">
";
echo "<input type=hidden name="returnforum" value="_admin">
";
echo "<input type=hidden name="returnmsg"
value="acahomepage">
";
} else {
echo "action = /path to different cgi
";
echo :different values for hidden fields".
}
I have an html form for that uses username and password to login to a
specific area of the website. The "area" the user wants to go to is
based on a pull down menu. Becasue the user/password info is in
differnet databases, how can I call different validation scripts based
on this input ?
See below please. Somethinglike this:
form.html:
<form name="loginform" method="post" action="login.php">
<select name="loginform">
<option value="one">Section 1</option>
<option value="two">Section 2</option>
</select>
login.php:
@extract($_POST);
if($_POST[loginform] == "one") {
echo "action = /forums/scc/dispatch.cgi/_admin/AVFLogin"
NAME="LoginForm" >
echo "<input type=hidden name="autologin" value="1">
";
echo "<input type=hidden name="formstyle" value="standard">
";
echo "<input type=hidden name="returnforum" value="_admin">
";
echo "<input type=hidden name="returnmsg"
value="acahomepage">
";
} else {
echo "action = /path to different cgi
";
echo :different values for hidden fields".
}


You can try these guys http://www.formmailhosting.com. They will do the form to email submissions plus store all the results in a MS Excel file. It's not a MySQL database but it does the trick and there's not hours of PHP coding.
ReplyDeleteHope this helps.
- Bryan