I want to display a table from database in phpMyAdmin by putting the following conditions that in every different options in drop down menu it displays different table from database by pressing the button of search. But it is not doing so.
<p class="h2">Quick Search</p>
<div class="sb2_opts">
<p></p>
<form method="post" action="" >
<p>Enter your source and destination.</p>
<p>From:</p>
<select name="from">
<option value="Islamabad">Islamabad</option>
<option value="Lahore">Lahore</option>
<option value="murree">Murree</option>
<option value="Muzaffarabad">Muzaffarabad</option>
</select>
<p>To:</p>
<select name="To">
<option value="Islamabad">Islamabad</option>
<option value="Lahore">Lahore</option>
<option value="murree">Murree</option>
<option value="Muzaffarabad">Muzaffarabad</option>
</select>
<input type="submit" value="search" />
</form>
</form>
</table>
<?php
$con=mysqli_connect("localhost","root","","test");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(isset($_POST['from']) and isset($_POST['To'])) {
$from = $_POST['from'] ;
$to = $_POST['To'] ;
$table = array($from, $to);
switch ($table) {
case array ("Islamabad", "Lahore") :
$result = mysqli_query($con,"SELECT * FROM flights");
echo "</flights>"; //table name is flights
break;
case array ("Islamabad", "Murree") :
$result = mysqli_query($con,"SELECT * FROM isb to murree");
echo "</isb to murree>"; //table name isb to murree
;
break;
case array ("Islamabad", "Muzaffarabad") :
$result = mysqli_query($con,"SELECT * FROM isb to muzz");
echo "</isb to muzz>";
break;
//.....
//......
default:
echo "Your choice is nor valid !!";
}
}
mysqli_close($con);
?>
Hello everybody,
I have multi-step form and user can navigate to any page to modify or add information. There is a menu that shows progress and steps user completed. This menu allows to navigate to any step user completed or going to complete.
Inspite of big button "Save and Continue" some users click this menu to navigate further. I have to check - if values have changed in a form and ask: "Save changes? Yes/No".
What is the best way (with minimum code) you suggest me to check if form values have changed.
Thank you in advance!
<form enctype="multipart/form-data" method="post" action="mailto:[email protected]" accept-charset="UTF-8">
Is there a problem if mails are sent this way .. i wanna avoid using PHP codes..
I have a component and I want to make a textarea on the admin backend interface use the TinyMCE editor:
How do I reference the TinyMCE that is being used by other components (instead of duplicating it)
2.) How do I hook into the page init or some place where I can let TinyMCE do it's magic (of if Joomla provides a way)
Thanks
Is it possible to take a screen capture of a particular area of a web-page from the web-page's own ASP.NET code?
I need to display 6 images that are stacked on top of one another using CSS, and I'd like to offer the user the ability to right-click save-as if possible by stacking the screen capture on top top of the original image stack.
Any thoughts?
Thanks
For example I have:
<div id ="test">[the content here]</div>
The content within the div tags will appear after I called the id of div using ajax.
This is the code:
function dinamic(add)
{
var kode = add.value;
if (!kode) return;
xmlhttp2.open('get', '../template/get_id.php?kode='+kode, true);
xmlhttp2.onreadystatechange = function() {
if ((xmlhttp2.readyState == 4) && (xmlhttp2.status == 200))
{
var add = document.getElementById("test");
add.innerHTML = xmlhttp2.responseText;
}
return false;
}
xmlhttp2.send(null);
}
So it will appear <div id="test">A</div>
I'd like to put the content of div - A into mysql query.
$test = $_GET['test'];
$query = "select * from example where category='$test'";
I've tried to make variable $test of the div id to get the content but result of the query in category is none.
I tried again, I put the div in to the query
$query = "select * from example where category='<div id=\"test\">A</div>'";
Yes, It works. But when I did query on navicat, no results I got because there's spaces between A that is <div> and </div>.
How to remove/hide the div tags only so its only appear the content?
> $query = "select * from example where category='A'"; <
Edit:
If I echo the query on firefox browser will say "$query = "select * from example where category='[space]A[space]'";"
And look at the bug(I use firebug), it will say "$query = "select * from example where category='<div id="test">A</div>'";"
So my guessing why can't get result after query on navicat is there's spaces between A([space]A[space]), just have no idea how to remove/hide the div tags, I want to get this result only "$query = "select * from example where category='A'";"
Thanks.
In this form code what is the role of name="" attribute?
name="s" and name="submit".
Is it necessary to add?
<form action="/index.php" method="get">
<fieldset>
<legend>Search</legend>
<label for="s"><span>Search WaSP</span>
<input value="" name="s" id="s"></label>
<input type="submit" value="Go!" name="submit" >
</fieldset>
</form>
I would like to take what text is in my p tag and make that the p tags parent (div) that ID. I would also like to add a _ for any spaces in the p tag.
Example:
<div class="circle"><p>Apple</p></div>
<div class="circle"><p>Banana</p></div>
<div class="circle"><p>Carrot Juice</p></div>
to
<div id="Apple" class="circle"><p>Apple</p></div>
<div id="Banana" class="circle"><p>Banana</p></div>
<div id="Carrot_Juice" class="circle"><p>Carrot Juice</p></div>
Hello,
I was able to get the navigation dropdown to show the letters in a different color from the background (white in this case) in Chrome browser. But when I view the same page in IE or FF, the whole background is just all green.
Here is an example of such a page:
http://www.comehike.com/hikes/hikes_and_groups.php
And here is the CSS code that makes the color show up white in Chrome
navigation li li a
{color:#white; text-decoration:none;}
To see the difference, just mouse over the top right where it says "community" or "hikes"
Thanks,
Alex
I am using a checkbox that has the name selectedids[], and I am trying to select all checkbox with the JavaScript but the code is not working. However, when I change the name of checkbox to selectedids it works but I can't do so because I need all the ids that are selected on the POSTED page.
The checkbox is as follow.
foreach($rows as $row)
{
<input type="checkbox" name="selectedids[]" value="<?php echo $row['id']; ?>" class="checkbox" />
........
........
}
And the Java-script function is as follow
function SetAllCheckBoxes(CheckValue)
{
var CheckValue=true;
if(!document.forms['main'])
return;
var objCheckBoxes = document.forms['main'].elements['selectedids[]'];
if(!objCheckBoxes)
return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
objCheckBoxes.checked = CheckValue;
else
// set the check value for all check boxes
for(var i = 0; i < countCheckBoxes; i++)
objCheckBoxes[i].checked = CheckValue;
}
Please help me.
Thanks in advance..
I'm working on an application where dates are passed as yyyy-mm-dd but displayed to the client as mm-dd-yyyy (US based client).
I'm using a jQuery datepicker for selecting from/to dates in a report and would like to show the dates to the client as mm-dd-yyyy but when the form is submitted, submit as yyyy-mm-dd.
Is it possible to display one value in a textinput textbox and have another submitted without needing to hook into onSubmit?
I've come up with the following alternatives:
Hide the text input for the from and to fields, create dummy fields and make use of the following jQuery date picker functions: altField and altFormat to display the value to the client in their preferred way and deal only with the submitted values which are set through the alt functions.
Have an onSubmit javascript call to change the dates from mm-dd-yyyy to dd-mm-yyyy and also change the value=" to change the date to the client's preferred format.
Rewrite the app to handle all dates in mm-dd-yyyy and hope the client never has non-US customers that would like their dates in a specific format.
Change all dates to dd-Mon-YYYY e.g. 26-May-2010 as all of our client's customers are guaranteed to be English only.
I have a textbox used to enter the text by user, which guide-text which disappears when user starts to write. But when I use a dropdown & select a text from it, & this text is automatically entered in the textbox, the guide-text is not fading away.
Events I am using to fade the guide-text :
$('input, textarea').live('keydown', toggleLabel);
$('input, textarea').live('paste', toggleLabel);
On change of dropdown :
$('.ui-discussion-text').change(function () {
var oldText = $('.ui-discussion-input textarea').val();
$('.ui-discussion-input textarea').val(oldText + " " + $(this).val());
});
Please help.
I know this is simple as cake but I've been using ASP.NET controls for way too long. I assume you have to do this via javascript with a regular XHTML input tag?
I have two divs, one inside another. The outter one is called #wrapper, while the inner one is called #pad.
Now #pad allows user input, and I have a javascript (jQuery) function that changes the content of #pad based on what the user input is. Sometimes, because of this function, #pad's content will cause the div to become more elongated than before. Now obviously I would wish for #wrapper to grow longer as well to accommodate this change in #pad's length. However, this does not occur.
#wrapper
{
clear:both;
padding-top:0.5em;
/*padding-left:50px;*/
height: 100%;
background-color: rgba(255,255,255,0.4);
-moz-border-radius: 20px 20px 0px 0px;
-webkit-border-radius: 20px 20px 0px 0px;
border-radius: 20px 20px 0px 0px;
}
#pad
{
margin-top: 25px;
-moz-border-radius: 5px;
border: solid 1px #DDD;
margin-left:25px;
padding-left:25px;
margin-right:25px;
padding-right:25px;
margin-bottom:2em;
}
This is the javascript function:
function preview()
{
var id1=$("#input1").val();
var id2=$("#input2").val();
var id3=$("#input3").val();
var id4=$("#input4").val();
var id5=$("#input5").val();
if(id1!= null && id1!="")
{
if( $("#preview1").attr("src")!=id1)
{
$("#preview1").attr("src",id1);
$("#preview1").fadeIn("slow");
}
}
else
{
$("#preview1").attr("src","");
$("#preview1").fadeOut("slow");
}
if(id2!= null && id2!="")
{
if( $("#preview2").attr("src")!=id2)
{
$("#preview2").attr("src",id2);
$("#preview2").fadeIn("slow");
}
}
else
{
$("#preview2").attr("src","");
$("#preview2").fadeOut("slow");
}
if(id3!= null && id3!="")
{
if( $("#preview3").attr("src")!=id3)
{
$("#preview3").attr("src",id3);
$("#preview3").fadeIn("slow");
}
}
else
{
$("#preview3").attr("src","");
$("#preview3").fadeOut("slow");
}
if(id4!= null && id4!="")
{
if( $("#preview4").attr("src")!=id4)
{
$("#preview4").attr("src",id4);
$("#preview4").fadeIn("slow");
}
}
else
{
$("#preview4").attr("src","");
$("#preview4").fadeOut("slow");
}
if(id5!= null && id5!="")
{
if( $("#preview5").attr("src")!=id5)
{
$("#preview5").attr("src",id5);
$("#preview5").fadeIn("slow");
}
}
else
{
$("#preview5").attr("src","");
$("#preview5").fadeOut("slow");
}
setTimeout("preview()",1000);
$("#wrapper").attr("height",$(document).attr("height"));
}
http://surveys.mylifeisberkeley.com/
I couldn't find a similar question, that's why here it is:
Whats the best way to hide or encrypt an email link in a website, so that a crawler can't read it, but the user can nevertheless click it?
I don't want to conufse the users by typing the email like this: john (at) mail.com or similar ways. (and i think this kind of links can nevertheless read by crawlers?)
I also tried things like that:
<script>// <![CDATA[eval(unescape('%76%61%72%20%73%3D%27%61%6D%6C%69%6F%74%72%3A%62%61%40%65%64%61%6E%6F%6C%2E%69%27%3B%76%61%72%20%72%3D%27%27%3B%66%6F%72%28%76%61%72%20%69%3D%30%3B%69%3C%73%2E%6C%65%6E%67%74%68%3B%69%2B%2B%2C%69%2B%2B%29%7B%72%3D%72%2B%73%2E%73%75%62%73%74%72%69%6E%67%28%69%2B%31%2C%69%2B%32%29%2B%73%2E%73%75%62%73%74%72%69%6E%67%28%69%2C%69%2B%31%29%7D%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%27%3C%61%20%68%72%65%66%3D%22%27%2B%72%2B%27%22%3E%4F%62%65%72%70%61%72%6C%65%69%74%65%72%3C%2F%61%3E%27%29%3B'))]]></script>
but i heard this can also be read by crawler and it isn't really good practices
are ther any common approaches?
I am developing a new e-commerce website in java. My index page has links such as Login etc. I had gone through other e-commerce sites such as ebay where they have option of My Account. My question is before signing in to the account ,why do they need this link My Account. what is the significance of this. can any web designer let me know the answer?
I have a strange problem where an onclick event on an input image is being fired when i hit enter in input text box
<form id="MyForm" action="/someaction">
<input type="image" src="someimage.jpg" onclick="doStuff();$('#MyForm').submit();" />
<input type="text" name="textInput"/>
</form>
When the cursor is in the text box and i hit enter, rather than the form being submitted it calls the onclick event on the image input.
Any ideas whats going on ?
Hello there.
I've followed a tutorial and came up with the following method to read the webpage content into a CharSequence
public static CharSequence getURLContent(URL url) throws IOException {
URLConnection conn = url.openConnection();
String encoding = conn.getContentEncoding();
if (encoding == null) {
encoding = "ISO-8859-1";
}
BufferedReader br = new BufferedReader(new
InputStreamReader(conn.getInputStream(),encoding));
StringBuilder sb = new StringBuilder(16384);
try {
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
sb.append('\n');
}
} finally {
br.close();
}
return sb;
}
It will return a representation of the webpage specified by the url.
However,this representation is hugely different from what I use "view page source" in my Firefox,and since I need to scrape data from the original webpage(some data segement in the original "view page source" file),it will always fail to find required text on this Java representation.
Did I go wrong somewhere?I need your advice guys,thanks a lot for helping!
Say I have a form that looks like this:
[ Animal name input field ] Add button
If I type a name and hit enter, an animal with the given name is added to a table. Works fine. What I would like now is to call the current way of working "quick add" and add a new feature called "slow add", which I am not quite sure how to do. Basically what I want is that if for example the shift key is held down when enter or the button is clicked, I want the form submit method to do something slightly different. In my case I want it to open up a form where more details on the animal can be added before it is added to the table.
Problem is I'm not quite sure how to do this. I have tried add a FireBug console.info(eventData) in my current submit function and I have found that the eventData contains an altKey, shiftKey and controlKey property, but they are always undefined even when I hold those keys down.
So, does anyone know how I can do something special in my submit handler when certain modifier keys were pressed when the form was submitted?
I have a form and it contains dropdown box and different div items. Based on selection from dropdown box, I show those div items. But some of the text in those div items are shown when the form is loaded and not when I select the option from dropdown box. The code is somewhat like this
<form>
<select id="">
<option value="one"> One </option>
<option value="two"> Two </option>
<option value="three"> Three </option>
</select>
<div id="onee"> header text ..<table> </table></div>
<div id="twoo"> header text ..<table> </table></div>
</form>
So when I load the page form with select drop down box is shown , but it also shows header text which is within div. How do I hide that text?
How to detect ctrl+v ,Ctrl+c using Javascript?
i need to restrict pasting in my textareas,end user should not copy and paste the content,
user should only type text in text area.
how to achive this.
Thanks in advance.