You're missing the = in your password field name property.
You have:
<input type ="password" name'p' />
Should be:
<input type ="password" name='p' />
You're missing the = in your password field name property.
You have:
<input type ="password" name'p' />
Should be:
<input type ="password" name='p' />
I don't know what you want to dictate what element gets what color. But if you create three different CSS styles you can change the class of a td element:
document.getElementById("234").className = "green_box";
if that table row is between your <form> and </form> tags than it should be picked up automatically for the POST data. If that's not the case you could add a little fail safe:
$("#form-id").submit(function(){
if ($('#section-name').length == 0) {
//It was added, append the selected value to our form
var the_value = $("#section-name").val();
var new_field = "<input type='hidden' name='section' value='" + the_value + "' />";
$("#form-id").append(new_field);
}
});
It's not ideal or pretty but if you have that table row insdie the form tags and it's not adding it to your POST data it's a doable work-around. Just swap form-id with your actual form ID
Sorry, your $row variable is only available within the scope of your while loop:
while($row = mysql_fetch_array($result)) {
//print out the contents of each row
echo "<tr><td>";
echo $row['id'];
$veh_id = $row['id'];
echo "</td><td>";
echo $row['year'];
echo "</td><td>";
echo $row['make'];
echo "</td><td>";
echo $row['model'];
echo "</td><td>";
echo $row['mileage'];
echo "</td><td>";
echo $row['description'];
echo "</td></tr>";
}
?>
...
<input type="text" name="veh_id" value="<?php echo $veh_id; ?>">
That's appending the options, what about the actual select field? Is this:
<select name="sectionname" id="section-name"></select>
already part of the form and you're just adding options or are you adding that to your form with jQuery as well, if so how?
If you're appending the element to the form it should be available on your POST without any further action. How are you adding the additional element?
If you are only pulling one result from the DB than on your main page inside your upload form:
<input type="hidden" name="veh_id" value="<?= echo $row['id']; ?>" />
Than on your upload.php file:
$veh_id = $_POST['veh_id'];
That still doesn't explain where your $file['field2'] and $file['description'] array is being set?
Based on this code you can have several different ID's but only one upload form. How is the user picking which veh they are upload the photos for? You just need to add a hidden form field to your form once you know<input type="hidden" name="veh_id" value="<?= echo $row['id']; ?>" />
How are file['description'] and file['field2'] being set? I would need to see the rest of the code
code itself just echos out on to the page now though
Could you explain what you mean by this?
If you goto google (or your favorite search engine) and type gmail API, ymail API, hotmail API, Facebook API etc etc it's the first search result that comes back it's not diffacult to find
I think I understand what you're trying to do.
$raw_text = trim($file['description']);
if(strlen($raw_text)>200) { $raw_text = substr($raw_text, 0, 200) . "..."; }
$final_text = str_replace('*', $file['field2'], $raw_text);
echo "<p>$final_text</p>";
A lot of the big social media websites have what's called an API (i.e. https://dev.twitter.com/ and http://developers.facebook.com/) which will allow you to have a user login to their account from your website at which point you can interact with their friends.
You want to show a different image depending on which item is selected from the drop down list? Do I understand you correctly?
Should just need to remove the echo "</table>"; from within your while loop, put it just fater your closing bracket as urtrivedi suggested. What's happening now if you view sorce you'll see that at the end of each row there will be an </table> and no new table started.
If your child class doesn't have a constructor PHP will automatically try to execute the Parent's constructor. If you define a constructor in the child class, than you need to tell PHP to also construct the parent. There is some good info here if you're interested: http://php.net/manual/en/language.oop5.decon.php
Your parent class constructor requires a variable be passed to it. You need to pass the co-worker's name. parent::__construct($coworker_name);
Because you have defined a constructor for the child class the parent constructor is not implicitly called. When you define a constructor you must construct the parent to make the functions available to it:
function __construct($coworker_name)
{
parent::__construct();
$this->set_name($coworker_name);
}
Coverted into PDO with Error catching, the duplicates may have been caused by not finding any users with that city:
$cityQuery = 'SELECT Query fetching all cities within 20 miles of current location';
$try {
$cityResult = $pdo->query($cityQuery);
}
catch (PDOException $error_msg)
{
echo "The following query caused an error: $cityQuery<br />Error: ";
echo $error_msg->getMessage();
}
if($cityResult->rowCount() > 0)
{
while($cityRow = $cityResult->fetchObject())
{
echo "The following user live in " . $cityRow->city . ": <br />";
$userQuery = 'SELECT * FROM users_table WHERE city="' . $cityRow->city . '"';
$try {
$userResult = $pdo->query($userQuery);
}
catch (PDOException $error_msg)
{
echo "The following query caused an error: $userQuery<br />Error: ";
echo $error_msg->getMessage();
}
if($userResult->rowCount() > 0)
{
while($userRow = $userResult->fetchObject())
{
echo $userRow->username;
echo "<br />";
}
}
else
{
echo "Sorry, no users found";
}
}
}
else
{
echo "Sorry, we didn't find any cities close to you";
}
The easiest way is can hide all than re-display the one you want:
function handleSelection(choice) {
document.getElementsByClassName('hide').style.display="none";
document.getElementById('select').disabled=false;
document.getElementById(choice).style.display="block";
}
Does the city column in your zipcode table use a capital C "City" ??
if you add this before your $user_query it will give you the structure of the array:
var_dump($current_city);
Are you sure the catagory is being set properly? What do you get if you var_dump($cat); or echo $query; ?
That's odd, you shouldn't get the repeat. What do you get as output if you do the following:
$city_query = mysql_query(" SQL Query fetching all cities within 20 miles of current location ");
while($current_city = mysql_fetch_assoc($city_query)){
$user_query = mysql_query("SELECT * FROM users_table WHERE city='" . $current_city['city'] ."'");
echo "The following users live in " . $current_city['city'] ":<ul>";
while($current_user = mysql_fetch_assoc($user_query)){
//you can do what ever you want to do with the users you get here
echo "<li>" . $current_user['name'] . "</li>";
}
echo "</ul><br /><br />";
}
Try this:
$city_query = mysql_query(" SQL Query fetching all cities within 20 miles of current location ");
while($current_city = mysql_fetch_assoc($city_query))
{
$user_query = mysql_query("SELECT * FROM users_table WHERE city='" . $current_city['city'] ."'");
while($current_user = mysql_fetch_assoc($user_query))
{
//you can do what ever you want to do with the users you get here
echo $current_user['name'] . " lives in " . $current_city['city'] . ".<br />";
}
}
Did you follow the information the other two posters gave you? Your $_POST array keys need to have the same capatalization as the form $_POST['Name'] $_POST['Email'] $_POST['Message'] Without that it will not work.
You'll have to use AJAX. If you are using jQuery the .post() or .ajax() functions will do this: http://api.jquery.com/jQuery.post/
I answered this question for you in you're other topic should do what you're looking for
You have to put your <select></select tags outside the foreach loop or it will start a new select box for each:
<select name="model" id="model" class="searchselectbox" onClick="toggleVisibility('pricelabel'); toggleVisibility('price');" onchange="this.form.submit();">
<?php foreach($recordset as $record){ ?>
<option value="<?php echo $record['type'];?>"><?php echo $record['type'];?></option>
<?php } ?>
</select>
Sry for double post I took a look and it won't let me re-edit the above post.
You're getting that error because your query has failed. When it fails it returns FALSE hence the boolean error.
I would break your query down and add error handling to help identify the issue
$sql = "SELECT COUNT(`id`) FROM `posts` WHERE `id`=$question_id";
$result = mysql_query($sql) or die (mysql_error());
Disregard.... just DaniWeb changing the post above on me so it's already been done
your return and line feed characters have double slashes which causes them to be ignored should be \r\n
alert(data[0].Title);
I told you in your previous topic the Same Origin Policy would prevent you from stealing content from someone else's website. Unless you have permission to use their catalogue and they've setup a JSON request for you it will not work.
You can load page fragments using jQuery's .load function, however based on what you've stated it sounds like you're trying to steal a section from someone else's website so due to the Same Origin Policy, the short answer is no.
Yeah I've looked over the PHP code several times and nothing is jumping out at me as being wrong. Only suggestion I would have is to var_dump($_SESSION) as maybe something isn't getting set as you expected it to.
Your sprintf("%01.2f", $total) are you just trying to print out the total with two decimals?
if you var_dump($unit_price) what does it give you?
Are you including the dollar sign ($) in your price? If so make sure you escape it \$ or ASCII it
You need to seperate the two options into two forms than have if statements to display the results depending on what was selected:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>View</title>
</head>
<body>
<form action="view.php" method="POST">
<td> </td><label>By Section: </label>
<td> </td><select name="Section" value="<?php echo $Section; ?>">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
</select>
<td> </td><input type="submit" value="GO" name="sec"/>
</form>
<form action="view.php" method="POST">
<td> </td><label>By Year: </label>
<select name="Year" value="<?php echo $Year; ?>">
<option value="1">First Year</option>
<option value="2">Second Year</option>
<option value="3">Third Year</option>
<option value="4">Fourth Year</option>
</select>
<td> </td><input type="submit" value="GO" name="year"/>
</form>
<?php
include('quiz1_connect.php');
mysql_connect("$server", "$user", "$pass")or die("cannot connect");
mysql_select_db("$db")or die("cannot select DB");
if (isset($_POST['sec']))
{
$Section = $_POST['Section'];
$query = "SELECT * FROM tblquiz1 WHERE SecName='$Section'";
}
if (isset($_POST['year']))
{
$Year = $_POST['Year'];
$query = "SELECT * FROM tblquiz1 WHERE YearLvl='$Year'";
}
if (isset($query))
{
$result = mysql_query($query) or die(mysql_error());
echo "<table border='1' cellpadding='10'>";
echo "<tr> <th>ID:</th> <th>First Name:</th> <th>Last Name:</th> <th>Year:</th> <th>Section:</th> </tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr>";
echo '<td>' . $row['IDNo'] . '</td>';
echo '<td>' . $row['FName'] . '</td>';
echo '<td>' . $row['LName'] . '</td>';
echo '<td>' . $row['YearLvl'] . '</td>';
echo '<td>' . $row['SecName'] . '</td>';
echo "</tr>";
}
echo "</table>";
}
?>
</body>
</html>
Your opening <form> tag should be before your first select box to group all your form options into the same form. Then when you click the search button it will submit all their selections to your search_results.php page
Your problem is not with the mysql_num_rows it is with the line before it the mysql_query line.
Your query line looks like this:
$result=mysql_query($query);
However you did not define the $query variable. Technicaly the error is at the query, but because it is not a serious error the code continues to go.
You place your querys in a variable named $SQL
You should replace either the $SQLs with $query or Replace $query with $SQL.
ie.
$result=mysql_query($SQL);
As well as a good habit you should put error catching on your queries to ensure they process properly like so:
$result=mysql_query($SQL) or die("Unable to process database query. Please contact the admin: " . mysql_error());
With this in place if there is an error with the query it will stop processing code, and display the error message above along with the error message from mySql
Couple of things:
Does the page address you are loading end in .php?
Did you go into the config file for Apache and do the required modifications for PHP pages?
Have you tried other scripts to make sure it is not the script?? The most common script used to test your PHP installation is php info script like so:
<?php
phpinfo();
?>
Type or copy that code into notepad and save it as info.php in your web folder, than load it in a browser. It should show all the info about your PHP and Server