nav33n 472 Purple hazed! Team Colleague Featured Poster

Why are you posting the same question so many times ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb Kommuru !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Try this.

<html>
<head>
</head>
<body>
<?php
print "<script type='text/javascript'>";
print "window.open('http://www.examples.com/page.html','new_window1','status=1,scrollbars=1,resizable=0,menu=no,width=320,height=220');";
print "</script>";  
?>
</body>
</html>
nav33n 472 Purple hazed! Team Colleague Featured Poster

There is something wrong with your query. Print out your query (print $sql ) and tell us what does it print.

nav33n 472 Purple hazed! Team Colleague Featured Poster

There are so many errors.
1. order id should be order_id
2. same with customer id.
3. You have 2 , in order id line
Try this.

CREATE TABLE orders (
order_id INT NOT NULL AUTO_INCREMENT ,
customer_id INT NOT NULL ,
amount DECIMAL( 4, 2 ) NOT NULL ,
date DATE NOT NULL ,
PRIMARY KEY (order_id)
) ENGINE = InnoDB
nav33n 472 Purple hazed! Team Colleague Featured Poster

I can show you a simple example.

<?php
$name = $_POST['name'];
echo $name;
//query the table with $name and display the data
?>
<html>
<head>
</head>
<body>
<form name="test" method="post" action="selecttest.php">
<select name="name" onchange="javascript: document.test.submit();">
<option value=''>Select one</option>
<option value=1>1</option>
<option value=2>2</option>
</select>
</form>
</body>
</html>
nav33n 472 Purple hazed! Team Colleague Featured Poster

-933

nav33n 472 Purple hazed! Team Colleague Featured Poster

Who am I ? .....
.... I am spiderman ! eh ?

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm..Strange.. I created a test table and tried the query with group by clause and it worked ! You should have posted this question in mysql forum(for better response).

nav33n 472 Purple hazed! Team Colleague Featured Poster

Check this tutorial. And here is an example how you can query your table..

nav33n 472 Purple hazed! Team Colleague Featured Poster

First of all, the input types doesn't have an id. So, getElementById will not work. Secondly, this isn't a popup. So, window.opener will not work. Try window.top.location.href .

nav33n 472 Purple hazed! Team Colleague Featured Poster

The point is, how you are storing the data in the table. select repair_status from table where job_number = '123' will display (the list) of repair_status for job_number 123.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay. Can you post your code ? I need to see why your page showing the 'default value' instead of the selected value ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Okay! I saw your other thread. Anyways, this is how you can make it work. Have an onchange event in your selectbox. When a value is selected, submit the page. (document.form.submit()). $_POST will have the value selected from the dropdown. Then check if it matches with each option value. If it matches, then echo "selected", or else, echo nothing.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

http://www.daniweb.com/forums/thread116723.html same question. See the example.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You have a name for the dropdown list. Right ? When you submit the form, you get the value of the dropdown list by doing $value = $_POST. Insert/update that value to the table.
You can see here how you can connect, insert or update mysql tables using php.
http://www.w3schools.com/php/php_mysql_intro.asp

nav33n 472 Purple hazed! Team Colleague Featured Poster
SELECT *
FROM registration
WHERE student_ID = '222222222'
AND year_of_Study = '1'
GROUP BY mod_id
ORDER BY academic_year DESC , resit_exam DESC
LIMIT 0 , 30

Doesn't this work ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

And what do you want to update ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Why be sarcastic about something that is quite clearly correct?

Quite clearly correct ? :icon_lol: setting the action of a form when a button is clicked is correct as well. Just like how "some" features of a stupid site doesn't work when javascript is turned off, a form which uses javascript to assign the action, wouldn't work.

You try to make a point that non essential things like "listen" buttons not working are "bad", yet cant see how ridiculous it is to create a form that wont function without javascript. DUH!!!!!

Thats exactly my point. If you "Turn off" javascript, anything dependent on javascript will fail.

Oh really? Paste your own code into a file, open it in your browser with javascript turned off. Then tell me that it still works :icon_lol: SURPRISE!!!!!..... it doesn't.

As I have already said umm.. more than 10 times, anything DEPENDENT on javascript WILL NOT work if javascript is turned off. Eg.

JavaScript must be enabled in order for you to use Gmail in standard view. However, it seems JavaScript is either disabled or not supported by your browser. To use standard view, enable JavaScript by changing your browser options, then try again.
To use Gmail's basic HTML view, which does not require JavaScript, click here.
If you want to view Gmail on a mobile phone or similar device click here.

Yes, a user CAN turn off javascript for your form.

Wow ! Is that so ? A user can turn off …

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are sarcastic about the reality of how bad your solution is? Now THAT is funny :icon_cheesygrin:

:twisted: Nope ! I was sarcastic about your first statement.

if the user has javascript turned off? Nothing happens, not good.

duh!

You spend so much time bagging a site because non essential javascript controls don't work when javascript is turned off in a user's browser (surprise, surprise!),

A user can't turn off javascript for a FORM (More surprise !!!).

yet cant see the reality of how bad it is to code an ESSENTIAL feature that is totally dependent on javascript.....

I thought the "LISTEN" button was an ESSENTIAL feature of that stupid site !

the ONLY point you have proved is how BAD our solution is.

:icon_rolleyes: Yeah, asking the user to have a hyperlink instead of what he asked for(ie., a button), is a VERY GOOD solution!

Yes, you are quite clearly jealous... that is even funnier :icon_lol:

Give me one good reason why I should jealous of one crappy site ? ;) If a site can make someone jealous, then oh yeah, I am jealous of yahoo, msn, google, and oh, daniweb as well ! LMAO.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Whats the error ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

What is the mistake and what is the error ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

No.. This is fine.. Nothing wrong with the table definition.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Huh! Well, it likes while loop if the resource id provided to it is correct. Check your query again. Maybe some details are missing.

nav33n 472 Purple hazed! Team Colleague Featured Poster

$query = "SELECT * FROM images_broad WHERE id=`1`";
$result=mysql_query($query);
while($row=mysql_fetch_row($result, MYSQL_ASSOC)){
echo '<img src="'.$row.'"/>';
}

Should be

$query = "SELECT * FROM images_broad WHERE id=`1`";
$result=mysql_query($query);
while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
echo '<img src="'.$row['broad1'].'"/>';
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post your latest code which showed PickupAddressPostcode on top ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Give this a shot

<input type='text' name='PickupAddressPostCode' value='<?=$row['PickupAddressCode'];' />

Umm.. doesn't make any difference since <?php echo $row is same as <?=$row; ?> .. Why not have your input box in the loop itself ? ie.,

while($row = mysql_fetch_array($result)){
echo "<input type='text' name='PickupAddressPostcode' value='".$row['PickupAddressCode']."'>";
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

And, if your table has more than 1 row, use while loop.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Array ( [0] => image/thumbs/thumb_1207138801.gif
[broad1] => image/thumbs/thumb_1207138801.gif )

Thats because, mysql_fetch_array returns both numeric index array and associated array name. Try mysql_fetch_array($result,MYSQL_ASSOC) and print !

nav33n 472 Purple hazed! Team Colleague Featured Poster

should the where clause look something like this

Help with Code Tags
(Toggle Plain Text)

$sql="UPDATE images_broad SET broad1='$broad1name2' WHERE broad1=`1`";

$sql="UPDATE images_broad SET broad1='$broad1name2' WHERE broad1=`1`";

if this line is correct it is effecting the preview page. when that page is accessed is says there is a problem with the mysql line

No. You are trying to update broad1 column where broad1 = 1. I hope your table has an id(counter) field which is an auto-increment field ? Use that to update the record.

if this line is correct it is effecting the preview page. when that page is accessed is says there is a problem with the mysql line

Help with Code Tags
(Toggle Plain Text)

while($row=mysql_fetch_array($result, MYSQL_ASSOC)){

while($row=mysql_fetch_array($result, MYSQL_ASSOC)){

should the while be taken out and the line edited so it looks like this

Help with Code Tags
(Toggle Plain Text)

$result=mysql_fetch_array($result, MYSQL_ASSOC)){

Basically, If your table has only 1 record, you don't need a while loop. But if your table has more than 1 record, then to fetch all the records, you have to use a while loop. My suggestion for you is, search for "file upload+php" in google. You will get alot of examples. Use one to upload an image to the server. While you upload an image to the server, save the path in the table(Insert a record and not update). So, whenever you upload an image, a path will be in the table. And for listing the images in the …

nav33n 472 Purple hazed! Team Colleague Featured Poster

-930

nav33n 472 Purple hazed! Team Colleague Featured Poster

When you upload a path, a new row is inserted and the "path" is stored in a column. But when you update the table(without a where clause), it updates all the rows and replace all the path values stored in the column with the new value. So, You should have a where clause while using update.

nav33n 472 Purple hazed! Team Colleague Featured Poster

if the code works for the images_broad table why will this not work for the new tables that have been created.

because there is nothing stored in the table before this code was run should i use the insert into query so that the table gets populated at least once and then change it to update.

Exactly ! You have to insert a record to the table in order to update it. And again, dont update all the records, but only one record.

nav33n 472 Purple hazed! Team Colleague Featured Poster

$sql="UPDATE images_tab SET tab1='$tab1name2'";

You are updating all the records to tab1name. Have a where clause and update only 1 record. Since you are updating all records, it shows the same image in the preview page.

nav33n 472 Purple hazed! Team Colleague Featured Poster

the type=file part of the form does this not mean that this is a browse button i have not changed this yet but if i put type=file1 would the file browse button still appear?

i will check and get back

No. Not that. <input type="file" name="uploadimage1"> This one.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome ! One suggestion, get a good editor and indent your code. That way, you can easily know where your problem is.

Cheers,
Naveen

nav33n 472 Purple hazed! Team Colleague Featured Poster

Have an onchange event for the select box. When the user selects a name, submit the page. $_POST will have the value selected by the user. Then query the table and get the values, print it.

nav33n 472 Purple hazed! Team Colleague Featured Poster

if (isset($_POST)) {

is open and not closed.

jino commented: thx u very much +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep, I guess..

nav33n 472 Purple hazed! Team Colleague Featured Poster

I checked it and this is what I find.
http://acmeart.co.uk/mercury/image/thumbs/thumb_1207128520.jpg all the images have the same path. That is why the image is being repeated. While fetching the path from the table, check if it returns the right path. Then, there are only 2 input type='file'. So whenever you upload an image and then another (using the same upload file tag) it gets replaced.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Whenever a user opens a page, add page's name to the session variable. Since you are adding it to the session, If he opens another window for the same page, redirect him to error page.
Eg.

//This is main.php which has link to page1.php
<a href="page1.php">Page 1</a>

This is page1.php

<?php
session_start();
if($_SESSION['page']=="page1"){
 header("location: error.php");
} else {
	$_SESSION['page']="page1";
}
echo "Hi";
?>

Now, right click on the page1.php and open it in a new page. It displays "Hi". Do the same again and you will be redirected to error.php.

Cheers,
Naveen

carobee commented: Great mind always at work +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Do you have these files on a server so that we can check the output ? Because, I don't understand what exactly is the problem..

kevin wood commented: very good at what he does. +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Add whatever value to $_SESSION and then check again. I guess it has to have username ? When the user logs in, assign the username to $_SESSION.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hello, Im new too, just today. Im in Devry university right now for computer information systems and love it.

Welcome reddaisy :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Welcome to Daniweb! What does your thread title "ohayogozaimasu" mean ?

nav33n 472 Purple hazed! Team Colleague Featured Poster
$selectedvalue = isset($_POST['selectbox']) ? $_POST['selectbox']:"default_select";

Then do the check as same as I have said above.

If ($selectedvalue == $row[0]) { echo "selected"; } else { echo ""; }