|-|x 126 Junior Poster in Training

Do you think I should get a "css reset?"

I would suggest at least starting your CSS definitions off with a global selector, something like this

* {
    margin: 0;
    padding: 0;
}

Think of it like painting your canvas white before painting the picture on it. Have a look at some sample ones online and see what you think is useful. You can also use these to set global default fonts and colour schemes on a per-site basis, if it is useful to you.

Do you think I should buy photoshop?

I can't make that call for you, it is a hefty investment and would depend on your needs and usage. However, I have not come across another editor that does as much as well as PS. But, that may also just be because I'm used to it and know how to do what I need easily.

|-|x 126 Junior Poster in Training

The SelectedIndexChanged event is not really an appropriate place to call databinding - at least not your initial databind. This event only fires when an existing item in the DataList is Selected by the user. See here for more info.

You should try moving the code you have from this event into the Page_Load function and see what you get.

|-|x 126 Junior Poster in Training

Further to the above... it is common for web developers to use a 'master reset' at the top of their css definitions. The purpose of this is to set defaults for clearing margin padding and anything else you may need.

There are a few different versions of these available if you google, but this is a good place to start.

|-|x 126 Junior Poster in Training

If you don't specify a height and width, then the browser defaults to a single "line" height.

If specified then the block element is rendered precisely to the height and width you specify. In this case there should not be extraneous whitespace.

Of course there are also margin and padding properties, which some browsers have different defaults for.
These should be set to 0px unless you specifically need/want them. And don't forget that these properties are inherited. In other words, consider the following example.

<div id="a" style="margin:5px;">
    <div id="b"></div>
</div>

in this case, both divs a and b would render with a 5px margin. In order for b not to have a margin, it must specify margin:0px.

|-|x 126 Junior Poster in Training

not if you define the size (height and width) values in its css as well. By default it will be 1 line high based on the current font size. But you can override this, even set height:0px - this is how some menus and collapsing divs work, by adjusting the height value dynamically with javascript.

|-|x 126 Junior Poster in Training

<BR> is a new line, but it also creates a blank line most of the time, depending on the display characteristics of it and the other elements on the page.

by specifying the display property of the a tags to be block, it tells the browser that each element is to be rendered as a block, on a new line, not next to the previous element. Hence you don't need the br's

|-|x 126 Junior Poster in Training

ah kk... you need to remove the brs from between the a tags.

|-|x 126 Junior Poster in Training

really? can you post your code again now.

|-|x 126 Junior Poster in Training

I get an error saying that my syntax is wrong

What is the actual error message you are getting? Is it from mysql or from PHP?

the line of code you posted doesn't have a semicolon at the end, which will generate a syntax error in php if its like that in your page.

Patiodude commented: The error message doesn't actually display an error code; very strange. +0
|-|x 126 Junior Poster in Training

I believe the PRIMARY statement needs to go at then end of all the column definitions

CREATE TABLE example (
  id int NOT NULL AUTO_INCREMENT,
  name varchar(30),
  age int,
  PRIMARY KEY (id)
)
|-|x 126 Junior Poster in Training

if you still have the spacing issue, try doing it this way instead:

.pecor {
    text-decoration: none;
    display: block;
    background-image: url("home.jpg");
    height: 49px;
    width: 111px;
}

and delete the img tag from inside the links.

------

I generally use photoshop for image editing, but you could try this, its supposed to be good.

|-|x 126 Junior Poster in Training

hmm... ok. check that the margin and padding for both the a and img tags are set to 0px.

I'll take another look later as well.

|-|x 126 Junior Poster in Training

Please explain what are value options

I just meant the possible values to be assigned to the display property. As that w3school page describes several, but the most common ones (that I use at least) are display:block;, display:inline; and display:none;

nice link btw. :) here is a different resource if you prefer.

|-|x 126 Junior Poster in Training

it just goes into your css definitions like so.

#pecor {
    display:block;
    ...
}

I believe the default for an anchor (a) tag is block, but it doesn't hurt to specify.

This page explains the various value options available for the display property. Most common you will use are block, inline and none.

(also I put more notes in the other post, not sure if you saw those before your reply)

|-|x 126 Junior Poster in Training

try removing the <br/>s from between each link and add display:block to the a style properties.
Also make sure the margin and padding is set to 0px;

Let me also make the suggestion that it is better to use the class attribute to identify groups of controls to apply the same styling to, rather than id

.im {
    ...
.pecor {
    ...

<a class="pecor" href="h.html"><img class="im" src="home.jpg" height="49" width="111" /></a>
                                            also, make sure you close your img tags  -^
|-|x 126 Junior Poster in Training

Both JorgeM and hericles are correct in their points. The reason your DataList is not visible when you initialy start the app is because SqlDataSource1 has no query and thus DataList1 will contain no data and not display.

|-|x 126 Junior Poster in Training

can you post an example? link or sample code, something we can test.

|-|x 126 Junior Poster in Training

@Mitch

I apologise, I wasn't intending to be negative - just pointing out that as far as I can tell everyone is posting basicallythe same things, and it doesn't seem to be what you are looking for. So, you need to clarify precisely what you want.

Your last post to Al does this a bit better. So, you are wanting to write your own WYSIWYG editor for PHP? or you want to find an existing one that is purely PHP based?

AFAIK all online WYSIWYG editors require javascript, otherwise you would have to post every change to the server before you could see the update - which would be a very tedious process to edit anything.
I have even written one myself in the past, but it also involves javascript in order to update the visual display of what you are editing.

The easiest one I have used is probably TinyMCE, but it is javascript based. You simply include this code in your page to convert a textarea into wysiwyg editor:

<script type="text/javascript" src="../tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
        mode : "textareas"
});
</script>

(taken from http://www.tinymce.com/wiki.php/Installation)

|-|x 126 Junior Poster in Training

I just want to know a free text editor that I can used to put it in the admin section

We have all pointed out several options available to you. Have you actually checked out any of the links or Googled for any of the suggestions?

I don't know how to put the text editor in the admin section meaning setup the text editor

I'm sure all of the suggested products have clear setup instructions on their websites.

He is asking me not you how this is going to work? Well, I tell Ardav I'm not sure either!

So, what exactly are you looking to get out of this thread? Since none of the suggestions so far seem to have satisfied your request, how can we help?

|-|x 126 Junior Poster in Training

you need to databind the DropDownList itself, as you point out correctly the ListItem doesn't have any data binding events.

<asp:DropDownList ID="ddlLocation1" runat="server" DataSourceID="dsLocation" DataValueField="TotalCost" DataTextField="Location" />
|-|x 126 Junior Poster in Training

Get rid of all the whitespace in the img src property - also, make sure the img tag is closed.

<img src=\"get.php?image_id=$lastid\"></img>

where are we getting _GET[image_id]?

this will pull the value from the querystring, ie: get.php?image_id=

$user_id = $_SESSION['user_id']; or _request?

I would think Session, unless you are passing the user_id to the page somehow

hwoarang69 commented: ic +0
|-|x 126 Junior Poster in Training

try adding quotes around your image source

 <img src ="get.php?image_id = $lastid">

dont forget to escape them in the php though

echo "Image upoaded.<p />your image:<p />
                      <img src = \"get.php?image_id = $lastid\">
                      ";

also, if you are passing the image_id to the get.php page, why aren't you using it to select the image?

eg:

mysql_query("SELECT * FROM image WHERE image_id = $_GET['image_id']");
hwoarang69 commented: kind of worked +0
|-|x 126 Junior Poster in Training

the array looks ok to me.

eval("var " + key + " = " + value);

it might be to do with the eval'd code not having a semicolon, but i'm really just guessing at this point.

eval("var " + key + " = " + value + ";");

Maybe its a restriction of jQuery or the for-each loop... sorry, I'm not particularly a jQuery expert. :(

|-|x 126 Junior Poster in Training

line 4 (above) of get.php should be echo base64_decode($image);

and the header needs to be set first, or it wont work.

oh, I also just noticed that you are getting the image_id via last insert id, but you are selecting based on the user_id in get.php

hwoarang69 commented: ty +0
|-|x 126 Junior Poster in Training

no, as long as image_id is an autoincrement field, this is the correct way to handle it.

According to the table schema you provided in the original post, there are 2 fields at the end you are not providing values for. Either you need to add values for these fields (null can be used if this is acceptable by the schema) OR you need to specify the columns list for which you are providing data.

|-|x 126 Junior Poster in Training

I would probably add this, and then insert as per your original insert query.

$image = base64_encode(file_get_contents($_FILES['fileupload']['tmp_name']));

then, yes, you call the base64_decode() when you want to display the image.

not sure what you are getting at with that user/password query, do you need to check the users login? Generally it is good practice to call mysql_real_escape_string() on any text input by a user before executing it on your database, as it can help prevent injection atacks as well as sql errors.

hwoarang69 commented: aesome +2
|-|x 126 Junior Poster in Training

I believe you can do it like this:

eval("var " + key + " = " + value);
|-|x 126 Junior Poster in Training

I also use notepad++, and I like Programmers Notepad as well. There is also PSPad.

For online editing, some editors have ftp capability or addons (I know notepad++ does) that let you edit files locally that reside on a remote server.

Also check out these links
http://sourceforge.net/projects/ontext/ (now defunct, but you can still download it)
http://www.tinymce.com/
http://ckeditor.com/

http://www.catswhocode.com/blog/10-useful-online-code-editors

of course there are more if you are willing to pay for them.

|-|x 126 Junior Poster in Training

@azareth: you don't need to specify the column names in an sql insert statement so long as you include values for all columns in the table in the order specified in the table schema.

|-|x 126 Junior Poster in Training

The problem is that your binary data (ie: image content) contains characters that are invalid in a mysql string.

Take a look at the LoadFile function if you have the image file available on the server, or you can escape the string in PHP prior to passing it to the mysql query.

Alternately, you could manually encode the binary data to base64, but you will need to ensure you also decode it when you read the data from the database.

|-|x 126 Junior Poster in Training

sounds like you need to configure the SMTP server for PHP to use.

|-|x 126 Junior Poster in Training

Yeah, the post variable will always be set, but the print_r call will show you if it contains any values and what they are, or if it is empty.

Cheers :)

|-|x 126 Junior Poster in Training

OK, firstly, the number of fields does not match up to your insert query. Looks like you are missing the email field out of the insert.

Sencondly, I assume user_id is an autoincrement key field. In order to make it work properly you need to insert NULL not and empty string.

"INSERT INTO user VALUES(NULL, '$firstname', '$lastname', '$username', '$password', '$email', '$dob', '$gender')"

You will need to make sure you grab the email from the post data, as it looks like you missed that (or I just can't see it)

It's also advisable to check the data for single quotes ' and other characters that may cause errors in the mysql and escape or remove them.

$firstname = str_replace("'","\'",$firstname);

etc.

also, your DOB variable is $dob_db, so check that in your insert statement.

|-|x 126 Junior Poster in Training

no problem, glad I could help. :)

|-|x 126 Junior Poster in Training

actually... I may have just spotted it.

at line #114 above, on completion of processing a successful post you are redirecting the browser to the same page. This will clear the previously posted data and rerun the same script

header('Location: register.php');

It is also redundant as they will already be on the register page, and redirecting will override any messages you wish to display to the user. I suggest removing this line and try it again, you may find it has been working the whole time. ;)

...
update... just tested this theory on my server, and I get the "dead" path executed with no post data as you have described. I will almost guarantee that this redirect is your root cause

diafol commented: good catch +14
|-|x 126 Junior Poster in Training

hmm... seems very strange. I have run and tested your code above and I get all the POST data correctly, and your isset($_POST['submit']) check is successful.

I can only conclude that the problem is not in this code file. Can you post what is in the included connect.php file?

Is there any parent code (such as templates or CMS stuff) that might be affecting / intercepting the code?

|-|x 126 Junior Poster in Training

Check the session_start() call like I said before as it may be resetting the POST variable.

Also, not sure if this may be causeing a problem or not, but all your html input tags are poorly formed having no close. ie:

<input type="submit" name="submit" value="Register">

should be

<input type="submit" name="submit" value="Register" />
                          // see tag close here ..  ^

In my experience a named submit button should be available in PHP via the POST variable, and should have the value assigned to the button (ie: its display text) in this case, it should be true that $_POST['submit'] == "Register"

It is possible that naming the button 'submit' may also be an issue, although I doubt it, but this is an easy thing to test.

Another thought... clear your browser cache and make sure you use ctrl+F5 to force a full refresh of the page (clear cookies as well to ensure you get a fresh session) as empty POST data can sometimes be caused by browser or proxy caching the POST request.

|-|x 126 Junior Poster in Training

yes, it would seem so.

I wonder if your call to session_start() or something in that include file is resetting/clearing the POST variable?

maybe try something like this and see if you get your post data

if (!isset($_SESSION)) {
  session_start();
}
|-|x 126 Junior Poster in Training

<form action="" method="post">

Don't you still need to specify the current page address for the postback to work?
disclaimer: it's entirely possible I'm wrong...

Also, for debugging purposes you could add print_r($_POST) to the top of the page to see what the actual post data contains on submit.

|-|x 126 Junior Poster in Training

so, you want to move the background image to the right?

background-position-x: 5px;

and try background-position: 50px 200px; on your body background to move the image lower and to the right.

JorgeM commented: good response +5
|-|x 126 Junior Poster in Training

Ok... so I will use your image as an example of what we could do.

First lets add an index parameter to your function.

<?php function ARG_FF($index) {?>
<tr>
    <!--AIR RESTRICTION GAUGE-->
    <td><select name="gauge[<?php echo $index; ?>]">
        <option value="8">8</option>
        <option value="11">11</option>
        <option value="15">15</option>
        <option value="22">22</option>
        <option value="25">25</option>
    </select></td>
    <!--FUEL FILTER-->
    <td><select name="filter[<?php echo $index; ?>]">
        <option value="20">20%</option>
        <option value="40">40%</option>
        <option value="60">60%</option>
        <option value="80">80%</option>
    </select></td>
</tr>
<?php }?>

Then we create a loop in the form to call the function and print the select controls.

<table>
    <tr><th>Air Restriction Guage</th><th>Fuel Filter</th></tr>
    <?php for ($i = 1; $i <= 8; $i++) { 
        ARG_FF($i);
    } ?>
    <!-- I'm not sure what your table footers are, but you can add a row here -->
</table>

This produces output like the following:

<table>
    <tr><th>Air Restriction Guage</th><th>Fuel Filter</th></tr>
        <tr>
    <!--AIR RESTRICTION GAUGE-->
    <td><select name="gauge[1]">
        <option value="8">8</option>
        <option value="11">11</option>
        <option value="15">15</option>
        <option value="22">22</option>
        <option value="25">25</option>
    </select></td>
    <!--FUEL FILTER-->
    <td><select name="filter[1]">
        <option value="20">20%</option>
        <option value="40">40%</option>
        <option value="60">60%</option>
        <option value="80">80%</option>
    </select></td>
</tr>
    <tr>
    <!--AIR RESTRICTION GAUGE-->
    <td><select name="gauge[2]">
        <option value="8">8</option>
        <option value="11">11</option>
        <option value="15">15</option>
        <option value="22">22</option>
        <option value="25">25</option>
    </select></td>
    <!--FUEL FILTER-->
    <td><select name="filter[2]">
        <option value="20">20%</option>
        <option value="40">40%</option>
        <option value="60">60%</option>
        <option value="80">80%</option>
    </select></td>
</tr>
    <tr>
    <!--AIR RESTRICTION GAUGE-->
    <td><select name="gauge[3]">
<!-- etc.... (cropped for brevity) -->

Then we just need to put your page code into a loop to process the mysql for each iteration.

for ($i = 1; $i <= 8; $i++) { 
    $gauge=$_POST['gauge'][$i];
    $filter=$_POST['filter'][$i];
    $gaugeFilter="INSERT INTO abc (ARG,Fuel_Filter) VALUES ('$gauge','$filter')";

    if (!mysql_query($gaugeFilter,$con))
    {
        die('Error: ' . …
|-|x 126 Junior Poster in Training

you could use arrays in the element names ... eg: <select name="filter[0]"> access via $_POST['filter'][0] etc.

|-|x 126 Junior Poster in Training

It is not difficult, though a little finicky as you have to use the DirectoryEntry and/or DirectorySearcher objects.

here is the official guide: http://msdn.microsoft.com/en-us/library/ms180906(v=vs.80).aspx

And some other examples to get you started;

http://www.daniweb.com/software-development/csharp/threads/339418/active-directory-search-filter-syntax-help

http://stackoverflow.com/questions/7915145/get-all-users-from-a-group-in-active-directory

|-|x 126 Junior Poster in Training

It could be on the css file itself, at filesystem level.

Imagine you are saving the css source code in a text editor. At the file save dialog, in some editors you can specify the character set of the file, ie: ascii, utf8 etc. If this has been set to something that conflicts with the web pages delivery as specified in the HTML source, this may cause the browser to interpret the css file contents incorrectly.

When I saved and opened the file I can see that it has been saved in a UTF8 format. The browsers default interpretation may not be detecting this.

Possible solution: You can specify the charset in the link tag. (Note the link tag should also have a close backslash, not sure if this may be affecting the functionality as IE can sometimes be more lenient on invalid HTML.) See this page for more details, but I would try something like this.

<link rel="stylesheet" type="text/css" charset="utf-8" href="http://www.classixrock.com/classix.css" />
JorgeM commented: appreciate it! +0
|-|x 126 Junior Poster in Training

It looks to me like it might be a charset configuration problem. If I view the CSS file in Chromes dev tools it shows up as Chinese text. The charset might be specified in the file itself or possibly in the web server where it is storing/delivering the file.

Check out the screenshot to see what I'm talking about.
chrome

JorgeM commented: great job on the troubleshooting! +4
|-|x 126 Junior Poster in Training

I think you have understood the problem correctly. The database will not work correctly if the UserID is Foreign Key to 3 separate user tables.

Rather than trying to condition the FK based on the Type field, it might be better in this scenario to split the UserID into 3 separate fields, each FK linked to the appropriate user table.

Example

CREATE TABLE login (
  LoginID varchar(20) not null,
  AdminID int null,
  PatientID int null,
  SLP_ID int null,
  Password varchar(20) not null,
  PRIMARY KEY (LoginID),
  KEY AdminID (AdminID),
  KEY PatientID (PatientID),
  KEY SLP_ID (SLP_ID)
);
ALTER TABLE login
  ADD CONSTRAINT login_fk1 FOREIGN KEY (AdminID) REFERENCES Admin (AdminID),
  ADD CONSTRAINT login_fk2 FOREIGN KEY (PatientID) REFERENCES Patient (PatientID),
  ADD CONSTRAINT login_fk3 FOREIGN KEY (SLP_ID) REFERENCES SLP (SLP_ID);

If you can post the SQL create scripts for your tables, and a sample data set we will be able to get a better idea of how to help you.

|-|x 126 Junior Poster in Training

What is the error you are getting?

I don't believe you can have an actual foreign key set up on the table pointing to multiple other tables, but it shouldn't be causing an error with duplicate values unless you have specified that field as unique

Copy your table/database structures and the data you are trying to insert here and we may be able to help identify the source of the problem.

|-|x 126 Junior Poster in Training

Assuming the autoincrement ID's do match up in both tables you could use a subquery like so...

...
WHERE BuyPortfolio.[STOCK ID] NOT IN (SELECT [STOCK ID] FROM Portfolio)

This will return all records in the BuyPortfolio table which are not in the Portfolio table according to the ID's.

|-|x 126 Junior Poster in Training

Where you are setting Tableid, I believe you are actually redeclaring a local variable with the same name, so your global is never getting set. Try removing the var from line 6 and see if that solves your problem.

Here is some general information on javascript variables that may also be helpful:
http://www.w3schools.com/js/js_variables.asp

|-|x 126 Junior Poster in Training

Try something like the below ... (this code assumes you have done the relevant sql object declarations)

Dim strFrom AS String = ""
strQuery = "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'Database1'"
con.Open()
theQuery.Connection = con
theQuery.CommandText = strQuery
theReader = theQuery.ExecuteReader
While theReader.Read
    If strFrom = "" Then strFrom = "FROM " & theReader("TABLE_NAME")
    ELSE strFrom &= ", " & theReader("TABLE_NAME")
    End If
End While
theReader.Close()
con.Close()