|
I want to check about duplication of records.
For example; if I want to put data of product name 'A' in database.
I found that this product is exist.
so I have 2 choices; update or cancel.
<?php
if(it_is_Existed)
{
echo $answer = "<script>confirm('do you want to change?')</script>";
if($answer)
{
update data;
}
}?>
I found that $answer 's value is not true or false;
but it is pop-up of confirm();
So, Whatever I choose yes or no, it is meaningless.
the data will update anyway.
can somebody help?
|
|
|
|
|
Try...
<form action='' method='post'>
<input type='text' value='' name='fav_movie'>
<input type='submit' name='vote' value='Add to Poll' onclick='return confirm("Are you sure?");'>
.. this should not submit if the user selects cancel on the popup and it will submit if they select ok. Your PHP should then check the posted values see isset() in php functions and processes from there
|
|
|
|
|
Experts,
I use to have a .html file which worked fine I then decided to add some php code which then meant i had to change the extension of the file. Now i have some flash videos which use to automatically play but now they don't... I am using dreamweaver and even tried using insert, media, flash video and still no luck
I kinda need these videos to play and the reason for the flash is all part of the security of the website
If any body can help that would be great
Dan
(I didn't really know which section to put this in so sorry if i did put it in the wrong section)
|
|
|
|
|
Hi,
How to solve no module named _tkinter problem
while running python program.
|
|
|
|
|
Lots of results for this error message on Google.
Look at this page under the section titled "Checking your Tkinter support". That might help.
http://wiki.python.org/moin/TkInter[^]
|
|
|
|
|
Hi,
accroding to that link document
"simply rerunning "make" should build the _tkinter extension."
Where to find the "make" i found in the python26 directory but,
i didn't found that "make" file from that directory.
|
|
|
|
|
Try renaming it to Tkinter, might work
|
|
|
|
|
I try to create contact form with captcha as security.
I found problem that when I submit form and I set that if it has any error go back to the input page
to correct.
When it goes back, the form is blank.
I want the form still remain what is in the textboxes or not reset data.
how can I do that?
I searched on Internet, it kinds of session_start() is problem
but when I deleted it, captcha is not work....
also, I try on delete captcha and test but still got the same result.
history.back(); then the previous page data is disappear.
|
|
|
|
|
You should redisplay the form, filling in the information that was entered.
|
|
|
|
|
I have already tried by use get method.
but it doesn't work.
header("Location:"."test2.php"."?name=$name&email=$email&message=$message&tel=$tel&country=$country&1=2");
in the input textbox did not show the values from _GET method correctly.
|
|
|
|
|
First, the register_globals option is now off by default and has been deprecated in PHP 5.3, so the line should be more like:
header('Location: test2.php?name=' . urlencode($_GET['name']) . ...
In PHP 5 there is a function for building the query string that does the hard work:
$args = array(
'name' => $_GET['name'],
'email' => $_GET['email'],
'message' => $_GET['message'],
'tel' => $_GET['tel'],
'country' => $_GET['country']
);
header('Location: test2.php?' . http_build_query($args));
The other thing to note is that you have to insert these values into the form:
<input type="text" name="name" value="<?php echo htmlentities($_GET['name']); ?>" />
|
|
|
|
|
I don't get it.
Ok、I will explain easily.
::::index.php::::
<form.....action ="save.php" method = "POST" ....>
</form>
::::save.php::::
if(check captcha is wrong)
{
echo......alert+history.back();
exit();
}
..............................
the code which u gave to me
I have no idea how to apply since my form use POST...
can I used both POST and GET??
|
|
|
|
|
Sorry, yes - you should use $_POST instead of $_GET for posted form data. The values on the form itself should use $_GET though, since they are passed back in the query string.
Here[^] is the relevant page from the PHP documentation.
|
|
|
|
|
To add memory to a page I use this pattern:
some_page.php
<?php
$uname = "":
if(isset($_POST['user_name']) && strlen($_POST['user_name'])>0))
{
$uname = htmlentities($_POST['user_name'],ENT_QUOTES);
}
echo "<form action='' method='post'>\n";
echo "<input type='text' name='user_name' value='".$uname."'>\n";
echo "<input type='submit' value='Save' name='action'>\n";
echo "</form>\n";
?>
This makes memory of the code easier. If the data being passed is not to much then you can use a $_GET instead of $_POST. Also the process logic can be moved into a separate script that you include to keep the main script here clean and readable. The echo'd form ends with a newline so you can view source in a browser for debug purposes.
|
|
|
|
|
Hello All,
Has anybody seen a BNF grammar for PHP?...preferably the 5.3.X?...some place you can point me to?
Cheers,
D
|
|
|
|
|
Maybe this[^] is helpful for you.
|
|
|
|
|
Thanks, that is very helpful
|
|
|
|
|
I have installed fedora from usb using Default option. After installation, internet is not working. I have configured the network using system-config-network but result is same. Internet not working .
Are there any drivers which need to be installed on fedora.?
Thnks
|
|
|
|
|
I am having a problem understand how to work with time zones in PHP
I am trying to create a function where i can pass it a time zone and it will calculate the time in that time zone.
i have read countless forms about this and still have hit a brick wall.
If any one has any links or information they can share on how to do this i would be forever grateful.
All i need to do is find out what the current time is in eastern pacific and central time zones.
|
|
|
|
|
This is a cut'n'paste from the DateTime::setTimezone section of the PHP manual:
Example #1 Setting and getting DateTimeZone objects
<?php
date_default_timezone_set('Europe/London');
$datetime = new DateTime('2008-08-03 12:35:23');
echo $datetime->getTimezone()->getName() . "\n";
$datetime = new DateTime('2008-08-03 12:35:23');
$la_time = new DateTimeZone('America/Los_Angeles');
$datetime->setTimezone($la_time);
echo $datetime->getTimezone()->getName();
?>
The above example will output:
Europe/London
America/Los_Angeles
Elsewhere in the date/time chapter there are heaps of examples of various date/time manipulations. What I think you want to do is something like this:
$datetime = new DateTime(something);
$datetime->setTimezone(xxx);
$timexxx = $datetime->format($formatstring);
$datetime->setTimezone(yyy);
$timeyyy = $datetime->format($formatstring);
[edit]fixed html quoting[/edit]
Software rusts. Simon Stephenson, ca 1994.
modified on Thursday, August 5, 2010 8:47 PM
|
|
|
|
|
you can use GMT time function for this u need to just pass gmt and it will return correct time.
plz explain more if ur problem is not solve with this
|
|
|
|
|
Hi guys,
I need to compile a MD5.cc on Linux shell but I keep getting these errors :
user@ubuntu /Desktop/Hash12$ g++ -Wno-deprecated md5.cc -o md5
In file included from md5.cc:48:
md5.hh:48:21: error: fstream.h: No such file or directory
md5.hh:49:22: error: iostream.h: No such file or directory
In file included from md5.cc:48:
md5.hh:58: error: ‘istream’ has not been declared
md5.hh:60: error: ‘ifstream’ has not been declared
md5.hh:60: error: ‘void MD5::update(int&)’ cannot be overloaded
md5.hh:58: error: with ‘void MD5::update(int&)’
md5.hh:66: error: expected `)' before ‘&’ token
md5.hh:68: error: expected `)' before ‘&’ token
md5.hh:73: error: ISO C++ forbids declaration of ‘ostream’ with no type
md5.hh:73: error: ‘ostream’ is neither function nor member function; cannot be declared friend
md5.hh:73: error: expected ‘;’ before ‘&’ token
md5.cc: In member function ‘void MD5::update(unsigned char*, unsigned int)’:
md5.cc:78: error: ‘cerr’ was not declared in this scope
md5.cc:78: error: ‘endl’ was not declared in this scope
md5.cc: At global scope:
md5.cc:140: error: variable or field ‘update’ declared void
md5.cc:140: error: ‘istream’ was not declared in this scope
Anyone have any idea what I need to do to compile successfully? Thanks alot!
|
|
|
|
|
xivShin wrote: I need to compile a MD5.cc on Linux shell
Why? Any normal Linux distribution should alredy include the md5sum program.
xivShin wrote: user@ubuntuUnsure /Desktop/Hash12$ g++ -Wno-deprecated md5.cc -o md5
In file included from md5.cc:48:
md5.hh:48:21: error: fstream.h: No such file or directory
md5.hh:49:22: error: iostream.h: No such file or directory
Those headers are obsolete since the ISO standard for C++ was accepted in 1998. Fix the errors in the source or find a non-obsolete version of MD5 (if you really don't have md5sum on your system).
|
|
|
|
|
Is there anyway that when you make a selection in a drop down list that it will be implemented without the need to then click the submit button.
My problem is this I have 3 drop down lists, size, font and colour all work fine if you click the submit button showing the selected font in the colour and size, but the page then refreshes and resets the lists. So what I am trying to do is implement any one list without refreshing the page so that the other two boxes do not reset.
Example, if I select size, then a font, then the colour, but do not like the font, I would have to go through the whole process again from scratch, instead of being able to just go back and select another font. I don't think it matters if the submit button has to be clicked or whether just making the select would have its own submit function.
This is the test page
http://www.sew-n-print.co.uk/render/person-e.php
Any suggestions would be welcome
|
|
|
|
|
Sure, you can use the onChange event of the combos to trigger some script.
I'd initially thought you'd have to use ajax, though now I'm not so sure.
If you only want to use the fonts on the client machines, you could use something like this:
<html>
<head>
<script type="text/javascript">
function byId(e){return document.getElementById(e);}
function setFont()
{
var tgt;
tgt = byId("output");
tgt.innerHTML = byId("textInput").value;
tgt.style.fontFamily = byId("fontCombo").value;
tgt.style.fontSize = byId("sizeCombo").value;
tgt.style.color = byId("colCombo").value;
}
</script>
<style>
body { background-image: url(darkbg2.jpg);}
</style>
</head>
<body onLoad="setFont();">
<select id="colCombo" onChange="setFont();">
<option value="#000000">Black</option>
<option value="#FF0000">Red</option>
<option value="#00FF00">Green</option>
<option value="#0000FF">Blue</option>
<option value="#FFFFFF">White</option>
</select>
<select id="sizeCombo" onChange="setFont();">
<option value="5mm">5mm</option>
<option value="1cm">10mm</option>
<option value="15mm">15mm</option>
<option value="2cm">20mm</option>
<option value="1in">25mm</option>
<option value="3cm">30mm</option>
</select>
<select id="fontCombo" onChange="setFont();">
<option value="arial">Arial</option>
<option value="courier">Courier</option>
<option value="impact">Impact</option>
<option value="tahoma">Tahoma</option>
<option value="wingdings">Wing Dings</option>
</select>
<br>
<input type="text" id="textInput" size=33 value="Enter text here.." onKeyUp="setFont();" onChange="setFont();"/>
<div id="output"></div>
</body>
</html>
Though, since you use an image in your implementation this may be unsuitable. In that instance, I'd just
use an image and give it an id. Then, in the setFont function you can just do something like:
url = "http://www.sew-n-print.co.uk/render/font.php"
url += "?text="+byId("textInput").value;
url += "&font="+byId("fontCombo").value;
url += "&color="+byId("colCombo").value;
url += "&size="+byId("sizeCombo").value;
url += "&vadj=50&hadj=25";
byId("myImgId").src = url;
I think that'll work.
<edit>
Yup, that works. Interesting (yet understandable) to see the lag for the image-based text.
Just make sure to remove the units from the size combo box, also the hashes from the colours.
Apologies for the total lack of formatting of the example code output.
</edit>
modified on Saturday, July 31, 2010 7:44 AM
|
|
|
|