|
Hi there.
What's difference between $_REQUEST and $_POST ?
And which of them is better to using ?
Thank you.
|
|
|
|
|
OK. Thank you for reply
We talked about it here[^] and I got my answer.
|
|
|
|
|
You can submit forms using one of two methods- GET or POST. These go into $_POST and $_GET arrays when received by a PHP script. You cannot access values in the $_GET array by using $_POST['value'] and vice versa. The $_REQUEST array however, contains both GET and POST values regardless. So if you post or get value 'x' in a form, it is accessible by $_REQUEST['x']. You can find more information here-
http://www.w3schools.com/PHP/php_post.asp[^]
Good luck!
Ranjit Viswakumar
Professional Services Specialist
rviswakumar@hostmysite.com
http://hostmysite.com/?utm_source=bb[^]
|
|
|
|
|
It was an old question.
Thanks anyway TapeBoy929.
|
|
|
|
|
i have a table counter with a attribute count (integer) with value = 1
i get the value of it
$sql = 'SELECT count FROM counter';
$result = mysql_query($sql, $link);
$row = mysql_fetch_assoc($result);
$tempcounter = $rows['count'];
$tempcounter = $tempcounter + 1;
now doing this i have the current value of count in a variable $tempcounter
i now need to update table to increment the counter;
$sql2 = "UPDATE counter SET count = $tempcounter";
i m having diffculties with the sql string
HELP
reply me at junaidzhotmail@hotmail.com
|
|
|
|
|
For starters, you can save yourself a lot of effort by just performing the update in MySQL:
UPDATE count SET counter = counter + 1
I'm finding the only constant in software development is change it self.
|
|
|
|
|
Here[^] is very useful website for learning MySql syntax .
Try it
|
|
|
|
|
Hi there.
Do you know when we must use LONGTEXT type in MYSQL?
Thanks in advance.
Freshman
|
|
|
|
|
|
|
hi,
When we need heavy data to store in a single field then we prefer this datatype.For example you may want to save a long page data in database and that can be greater then 16KB.As for TEXT datatype size is limited to 16KB.
Thanks.
-Inder Singh
|
|
|
|
|
Hello!
I am a webdeveloper at a Begining stage I am facing a problem on api application.please help me as soon as possible. The problem is....
Extracting Users photo from facebook and Myspace from a particular user's email address and password provided such as
Using user email and password we can fetch users profile photos.
Thanks
|
|
|
|
|
you can implement by searching in the phpclasses.org. I am also in same problem. Probably other expert will give us the solusion.
Soumen Nandy.
|
|
|
|
|
Facebook has an extensive developers API. If they don't have an API for image retreival it's likely what you want to do would be considered illegal.
Facebook Developers API[^]
You'd better read the fine print and make sure you can do this.
I'm finding the only constant in software development is change it self.
|
|
|
|
|
Hi friend.
I want to store an image to the MySql database's filed?
I don't know how I can do it
Can you help me ?
Freshman
|
|
|
|
|
|
Thank you. That was great
Freshman
|
|
|
|
|
You are most welcome..
|
|
|
|
|
M-Dayyan wrote: I want to store an image to the MySql database's filed?
Google is your friend. [^]
|
|
|
|
|
No, I don't think so.
You are my friend
A nice friend.
Isn't it.
|
|
|
|
|
Hello guru's
I am writing an API for my project in this case one of function return XML message ( actually its a small xml node ) i store that xml to an variable and if i alert if its show correct XML data, and if i pass it to function its give error <xml_variable> is not defined ........ I am very new in XML can any one told me where i am doing wrong. My complete code is given below.
<?
Required class file and javascript files.
?>
<html>
<head>
<title></title>
<link href="templates/<?php echo $TEMPLATE ?>/css/stylesheet.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="templates/<?php echo $TEMPLATE ?>/javascript/jstb_validations.js"></script>
<script type="text/javascript" src="templates/<?php echo $TEMPLATE ?>/javascript/AjaxRequest.js"></script>
<script type="text/javascript" src="templates/<?php echo $TEMPLATE ?>/javascript/xparse.js"></script>
<script language="javascript" type="text/javascript">
</script>
<!------- Validation for client side java script function ---------->
<script type="text/javascript">
function parseXML()
{
var device_type_name = document.getElementById('device_type_name').value;
var reporting_interval = document.getElementById('reporting_interval').value;
var module = document.getElementById('module').value;
var version = document.getElementById('version').value;
var s_key = document.getElementById('s_key').value;
var uid = document.getElementById('uid').value;
var lang = document.getElementById('lang').value;
var strUrl = 'api/index.php?device_type_name='+device_type_name+'&reporting_interval='+reporting_interval+'&module='+module+'&version='+version+'&s_key='+s_key+'&uid='+uid+'&lang='+lang;
// var strUrl = 'api/index.php?device_type_name=trewq&reporting_interval=10&module=ADD_DEVICE_TYPE&version=0.3&s_key=XYZ&uid=1&lang=english';
AjaxRequest.get(
{
'url':strUrl
,'onSuccess':function(req)
{
//alert(req.responseText);
var str_xml = req.responseText;
alert(str_xml);
// Note above alert show correct XML .
}
}
);
text="<note>";
text=text+"<to>Tove</to>";
text=text+"<from>Jani</from>";
text=text+"<heading>Reminder</heading>";
text=text+"<body>Don't forget me this weekend!</body>";
text=text+"</note>";
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
// xmlDoc.loadXML(text);
xmlDoc.loadXML(str_xml);
}
catch(e)
{
try // Firefox, Mozilla, Opera, etc.
{
parser=new DOMParser();
// xmlDoc=parser.parseFromString(text,"text/xml");
xmlDoc=parser.parseFromString(str_xml,"text/xml");
}
catch(e)
{
alert(e.message);
return;
}
}
/*
var to=xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;
var from=xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;
var message=xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;
alert(to);
alert(from);
alert(message);
*/
var to=xmlDoc.getElementsByTagName("result")[0].childNodes[0].nodeValue;
alert(to);
}
function ChkFrm_data()
{
frm=document.add_new_dev_type;
if(frm.device_type_name.value=="")
{
CustomAlert('<?php echo NECESSARY_FIELD_REQUIRED?>');
frm.txt_device_type_name.focus();
return false;
}
if(frm.reporting_interval.value=="")
{
CustomAlert('<?php echo NECESSARY_FIELD_REQUIRED?>');
frm.txt_reporting_interval.focus();
return false;
}
}
function CheckInteger(input_object)
{
if(!isNumeric(input_object.value))
{
CustomAlert('<?php echo NUMERIC_FIELD_REQUIRED?>');
input_object.value = "";
//next two lines are there for compatibility with FireFox
myField = input_object;
setTimeout("this.myField.focus();",0);
//input_object.focus();
return false;
}
}
function CustomAlert(message, message_header, message_type)
{
alert(message);
}
</script>
<!------- /Validation for client side java script function ---------->
</head>
<body class="body_inner">
<form action="add_new_dev_type.php" name="add_new_dev_type" method="POST" onSubmit="return ChkFrm_data();">
<table id="form_container">
<tr id="form_header">
<td colspan="2"><?php echo HEADING?></td>
</tr>
<tr id="form_message">
<?if(!empty($message)){?>
<td colspan="2"><?php echo $message;?></td>
<?}?>
</tr>
<tr id="field_row">
<td><?php echo DEVICE_TYPE_NAME?></td>
<td><input type='text' name='device_type_name' id='device_type_name' value='<?php echo $device_type_name ?>' /></td>
</tr>
<tr id="field_row">
<td><?php echo REPORTING_INTERVAL?></td>
<td><input type='text' id="reporting_interval" name='reporting_interval' value='<?php echo $reporting_interval ?>' onChange="return CheckInteger(document.getElementById('txt_reporting_interval'))" /></td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="module" id="module" value="ADD_DEVICE_TYPE">
<input type="hidden" name="version" id="version" value="0.3">
<input type="hidden" name="s_key" id="s_key" value="<?php echo $CURRENT_HASH?>">
<input type="hidden" name="uid" id="uid" value="<?php echo $USER_ID?>">
<input type="hidden" name="lang" id="lang" value="english">
<input type="button" onClick="parseXML()" name='Save' value='Save' />
</td>
</tr>
</table>
</form>
</body>
</html>
Note : if i pass XML "text" which is also write at this page this program work properly ... i am using this program from w3school
Please help me i am really bothered ... Thanks in advanced
Regard's
Kaushik
|
|
|
|
|
Well I didn't test it.
Just to say there are some XML classes here[^]
try those.
|
|
|
|
|
I am writing a simple form for a website I am developing and I keep getting parse errors, mostly dealing with quotes around HTML tags. Here is my code - any guidance would be appreciated. The errors I am getting are creeping up between the following 2 comment tags, to make it easier to identify:
///////////////////////////////////////////////////////
//check for existence of missing fields/error messages
///////////////////////////////////////////////////////
and
/* commented this out for testing of first part of script
/////////////////////////////
// WRITE DATA TO MYSQL table
/////////////////////////////
Here's my code:
<HTML>
<HEAD>
<TITLE>SHIRT SCRIPT</TITLE>
</HEAD>
<BODY>
<?php
include ("validation_functions.php4");
function shirtsSetup()
{
////////////////////////////////////////
//GET VALUES FROM SHIRT PORTION OF FORM
////////////////////////////////////////
$name = ($_POST['name']);
$address = ($_POST['address']);
$city = ($_POST['city']);
$state = ($_POST['state']);
$zip = ($_POST['zip']);
$email = ($_POST['email']);
$phone = ($_POST['phone']);
$quantity = ($_POST['quantity']);
$size = ($_POST['size']);
$color = ($_POST['color']);
$price = 15;
$shirtTotalPrice = $price * $quantity;
$instructions = ($_POST['instructions']);
$paypal = ($_POST['paypal']);
$check = ($_POST['check']);
$to = "myemail@yahoo.com";
$subject = "OMN T-Shirt order";
$message= "$name\n$address\n$city\n$state\n$zip\n$phone\n$email\n$phone\nquantity\n$size\n$color\n$instructions";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
//////////////////////////////
//CHECK FOR ERRONEOUS FIELDS.
//////////////////////////////
$error_msg = array();
$valid = verifyAlphaNum($name);
if(!valid) {
$error_msg[] = "Name must be letters, spaces, dashes and ' only";
}
$valid = verifyAlphaNum($address);
if(!valid) {
$error_msg[] = "Address must be letters, numbers, spaces, dashes and ' only";
}
$valid = verifyAlphaNum($city);
if(!valid) {
$error_msg[] = "City must be letters, spaces, dashes and ' only";
}
$valid = verifyAlphaNum($state);
if(!valid) {
$error_msg[] = "State must be two letters only";
}
$valid = verifyAlphaNum($zip);
if(!valid) {
$error_msg[] = "Zip must contain five numbers only";
}
$valid = verifyEmail($email);
if(!valid) {
$error_msg[] = "Email must be a valid format";
}
///////////////////////////////////////////////////////
//check for existence of missing fields/error messages
///////////////////////////////////////////////////////
if($error_msg)
{
echo "<ul>\n";
foreach($error_msg as $err) {
echo "<div align = "center"><li>" .$err. "<li>\n</div>";
}
echo "<div align = "center"></ul>\n</div>";
}
else
if (!$error_msg )&& ($paypal == 'on')
{
mail($to, $subject, $message, $headers);
echo "<div align = "center">Your Order: " .$size. " .$color. ".$quantity. ".$shirtTotalPrice. "<br /></div>";
}
/* commented this out for testing of first part of script
/////////////////////////////
// WRITE DATA TO MYSQL table
/////////////////////////////
mysql_select_db(database name, connection pointer) or die (Unable to select database.");
mysql_query('INSERT into TABLE_NAME (Name, Address, City, State, Zip, Email, Phone, Quantity, Size, Color, Instructions) VALUES ($name, $address $city, $state, $zip, $email, $phone, $quantity, $size, $color, $instructions)', $connectID) or die ("Unable to insert records into database.");
header ('Refresh: 3; URL = http://www.paypal.com');//REDIRECT TO PAYPAL.COM
exit();
}
else
if (!$error_msg )&& ($check == 'on')
{
mail($to, $subject, $message, $headers);
echo "Thank you for your order! Please allow 2-3 weeks shipping time.<br />"
Order will be shipped upon receipt of check.";
header ('Refresh: 3; URL = http://www.mypage.com'); //REDIRECT TO HOME
}
*/
}
?>
</BODY>
</HTML>
|
|
|
|
|
|
That probably would help, eh? . Here ya go....
Also, just to clarify my program, this is a t-shirt order form and the $paypal and $check variables ccorrespond to checkboxes asking if the user wants to pay by check or with paypal.
<html>
<head>
<title>Validations functions</title>
</head>
<body>
<?php
// print "included ok";
function verifyAlphaNum($testString)
{
if (eregi ("^([[:alnum:]]|-|\.||')+$", $testString))
{
return 1;
}
else
{
return 0;
}
}
function verifyEmail($testString)
{
if (eregi ("^([[:alnum:]]|-|\.||')+@([[:alnum:]]|\.|-
)+(\.)([a-z]{2, 4})$", $testString))
{
return 1;
}
else
{
return 0;
}
}
function verifyText($testString)
{
if (eregi("^([[:alnum:]]|-|\.||\n|\r|\?|\!|\"|\' ')+$",
$testString))
{
return 1;
}
else
{
return 0;
}
}
function verifyPhone($testString)
{
if(eregi('^([[:digit:]]||-)+$', $testString))
{
return 1;
}
else
{
return 0;
}
}
?>
</body>
</html>
|
|
|
|