A simple test program program is included.
enter data into dataone
click on create system
dataone data moved to datatwo
works with 5.3
with 5.4 when the create system image is clicked
the data in dataone disappears from the form and noting is passed to datatwo
we have a large number of programs that use this method of input fields and images to click on.
If I shift to 5.3 it works.
If I shift to 5.4 it wil not work.
<!DOCTYPE HTML>
</head>
<?php
$dataone = $HTTP_POST_VARS['dataone'];
$datatwo = $HTTP_POST_VARS['datatwo'];
if(isset($_POST['proc_x']))
{
$datatwo = $dataone;
}
?>
<form name="form1" method="post" action="test.php">
<table>
<tr>
<td><strong>
One</strong>
</td>
</tr>
<tr>
<td colspan="2"><input name="dataone" type="text" id="dataone"
value="<?php echo $dataone?>" size="70">
</td>
</tr>
<tr>
<td><strong>
two</strong>
</td>
</tr>
<tr>
<td colspan="2"><input name="datatwo" type="text" id="datatwo"
value="<?php echo $datatwo; ?>" size="70">
</td>
</tr>
</table>
<table>
<tr>
<td colspan="1"><div align="left" >
<input name="proc" type="image" id="proc" value="proc" alt="Create System"
title="Create System" width="25" height="25">
<strong>proc</strong></div>
</td>
</tr>
</table>
<table>
<tr>
<td colspan="2"><input name="inx" type="hidden" id="inx"
value ="<?php echo $inx; ?>" size="100">
</td>
</tr>
</table>
</form>
</body>
</html>
$HTTP_POST_VARS was deprecated long ago. I haven't actually seen anyone use it in nearly 10 years. Use $_POST instead.
Also, you have opened yourself up to potential XSS attacks. Always use htmlspecialchars() around any arbitrary data used in the context of HTML.
Related
Query 1.
form submitting working fine in local , but not working in live. I removed the action and put # and also i didn't call any script for redirect but while click the submit button it is automatically redirect to the same page. i don't know how it is redirecting ?
Query 2.
In action i mentioned <?php echo $_SERVER['PHP_SELF']; ?> and also gave direct url . if i print the post value it is not coming to POST .
In both ways it is showing the error
This page isn’t working
www.XXXXXXXXXXX.com didn’t send any data.
here below i paste my short code
<?php
ob_start();
session_start();
$_SESSION['captcha'] = rand(1000,9999);
include("./config/dbconnect.php");
include("./functions/functions.php");
if($_POST){
print_r($_POST); exit;
}
?>
<table border="0" width="100%"><tr><td style="padding-left:25px">
<form name="register" method="post" action="#" enctype="multipart/form-data">
<table width="634" border="0">
<tr>
<td colspan="3" class="sub_heading"><div align="right"><span class="style_r">* Mandatory Fields</span></div></td>
</tr>
<tr>
<td height="24" colspan="3"><div align="left" class="sub_heading">Login Information</div></td>
</tr>
<tr>
<td width="178">Email<span class="style_r">*</span></td>
<td width="10">:</td>
<td width="432"><input type="text" name="email" width="14" maxlength="50" /></td>
</tr> ******************* etc <tr>
<td colspan="3"><input type="checkbox" name="terms" />
I have read, understood and agree to the Terms and Conditions of eGulfCareers.com</td>
</tr>
<tr>
<td width="178"></td>
<td width="10"></td>
<td width="432"><input type="hidden" name="register" value="1" />
<input type="submit" name="submit" value="Signup" class="submit_button" /></td>
</tr>
</table>
</form></td>
</tr>
</table> `
I have a form which was working fine earlier. After a server upgrade to PHP 5.3 I now have a problem.
When my loop in the form (number of products) exceeds 9 or 10 lines, the form data is then lost, when sending it to the server.
What can be the problem? I am unable to understand why smaller loops are processed nicely and longer ones are not.
Below I have added some small parts of the code to show how the form is built.
<table id="top_header" class="pop_up" cellspacing="10" cellpadding="5" width="100%">
<tr class="floating header">
<td class="regel"><?php echo $lang['regel']; ?></td>
</tr>
<tr>
<td class="regel">
<input type="text" name="regel[]" value="<?php echo $regel; ?>" size="1" style="background-color: #e7e7e9" readonly="readonly" />
</td>
</tr>
<tr>
<td><input type="submit" class="btn_ok" onclick="this.disabled=true,this.form.submit();" value="<?php echo $lang['form_submit']; ?>" /> <input type="reset" class="btn_rst" value="<?php echo $lang['form_cancel']; ?>" /></td>
</tr>
</table>
<?php
$regel= trim(mysql_real_escape_string($_POST['regel']));
?>
I have also added the complete file to http://www.thure.nl/php_test/calculatie_plaat_edit.rar
I have a form like this
<form id= 'frm_request'>
<table class="opt_tbl1" align="center">
<tr>
<td><strong>TLD No.</strong></td>
<td colspan="2"><input type="text" id="tldno" name="tldno" size="25" maxlength="25" />
</td> </tr>
<tr > <td><strong>Name of Worker</strong></td>
<td colspan="2"><input type="text" id="fname" name="fname" size=50 maxlength=50 /></td>
</tr>
<tr>
<td ><strong>Date of Birth (Optional)</strong></td>
<td ><input id="new_day" name="dateofbirth" type="text" />
<tr>
<td colspan="3" align="center"><br/>
<input type="submit" name="_btn" value="Submit" action=""/></td>
</tr>
</table>
</form>
When the focus moves from input box “tldno”, the input “fname” to be filled by getting the html from another domain which I have no control. The html in the other domain, is like this:
<body>
<form method="POST" name="form1" action="../dbms/allindvres.asp" target="I1">
<table >
<tr>
<td width="33%" height="22" align="middle" ><font size=4>TLD No <input name="TLDNO" size="10"></td>
<td width="33%" height="22" align="middle" ><font size=4>CC No <input name="CCNO" size="10"></td>
<td width="33%" height="22" align="middle"><font size=4>or Name <input name="name" size="30"></td>
<td width="33%" height="22" align="middle">
<p align="center">< <input type="submit" value="Get Life Dose" name="B1"></p>
</td>
</tr>
</table>
</form>
<iframe name="I1" >
Your browser does not support inline frames or is currently configured not to display inline frames.</iframe></p></p>
</body>
Upon submitting the above form, the result will be displayed in the iframe. I want the whole html in my page so that I can scrap traverse through the html to get the name of the tldno holder and display it in my input box. Kindly help me to write an ajax call that will return this html
$("#tldno").blur(function(e){
// ajax POST call to the URL http://10.40.64.100/dbms/allindvres.asp with parameter tldno
//Get html
//do something with this html – This part I know.
});
Can any one help with the above method or suggest alternate methods?
Two important points in this question is, (1) I do not have control on the other domain. (2) the URL on the other domain accepts only POST not GET
I am new to php and I am having a hard time finding a good tutorial on how to do what I want to do. I know I want to have the feature to be able to add three variables and put the result into a textbox on the same page. Here is the code I have. I am getting an error when trying to display the result into a textbox. Any help appreciated.
<html>
<head>
<title>Field of View Calculator</title>
</head>
<body>
<form method="post" action="Test_Calculator.php" enctype="multipart/form-data">
<table width="1000" align="center" border="10">
<tr>
<td align="center" bgcolor="khaki" colspan="6"><h1>Field of View</h1></td>
</tr>
<tr>
<td align="center" colspan="1">Input</td>
<td align="center"" colspan="1">Intermediate Variables</td>
<td align="center" colspan="1">Output</td>
</tr>
<tr>
<td align="right" colspan="1">Number of Rings:</td>
<td><input type="text" name="rings" size="40"></td>
<td><input type="text" value="<?php echo $result; ?>" /></td>
<td align="right">Number of Rings:</td>
</tr>
<tr>
<td align="right">Wavelength:</td>
<td><input type="text" name="wave" size="40"></td>
</tr>
<tr>
<td align="right">Emitter Space:</td>
<td><input type="text" name="emitter" size="40"></td>
</tr>
<tr>
<td align="right">Static Values:</td>
<td align="center" colspan="6"><textarea name="content" cols="115" rows="15"></textarea></td>
</tr>
<tr>
<td align="center" colspan="6"><input type="submit" name="submit" value="Publish Now"></td>
</tr>
</form>
</body>
</html>
<?php
$result = 1 * 764000;
?>
You have to assign a value to $result before you try to echo it out.
Move the last 5 lines to the top of the file.
I am using the current code
<form method="post" action="<?php echo $PHP_SELF;?>">
<tr>
<td>Enter joker number:</td>
<td align="center"><input type="text" VALUE="<?php $joker ?>" name="joker"
size="3" maxlength="3"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit Order"></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['joker'])){
$joker = $_POST['joker'];}
?>
For the data entry of a form. Since this saves data as $joker in the php portion of my code, I was hoping that <?php $joker ?> would allow the previous data to be left on screen, but it didn't work. Any idea on how to refine my code?
Use your original code but move the php section above the HTML form code. And add echo in the embedded php directive.
Also set $joker as empty string or anything default at the top of the php code.
<?php
$joker = "";
if(isset($_POST['joker'])){
$joker = $_POST['joker'];}
?>
<form method="post" action="<?php echo $PHP_SELF;?>">
<tr>
<td>Enter joker number:</td>
<td align="center"><input type="text" VALUE="<?php echo $joker; ?>" name="joker" size="3" maxlength="3"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Submit Order"></td>
</tr>
</table>
</form>
Write only echo in php code before $joker. Thats it.
Do like following:
<input type="text" VALUE="<?php echo $joker ?>" name="joker"
size="3" maxlength="3">