Walkere 19 Junior Poster in Training

what I would like to do is to be able to offer a drop down list of values to select from ( which will come from a table in oracle) instead of the user remembering n entering a value, how can i achieve that ?

In HTML, what you're looking for is the <select> tag. This creates a dropdown list, like...

<select>
    <option value="value">Text</option>
    <option value="value">Text</option>
</select>

So what you need to do is get the result set from your database, loop through the result set, and create an <option> tag for each item in the result set.

I'm not familiar with the Oracle functions, so you'll have to create the query and what not yourself, but here's the idea.

$query = "SELECT value, text FROM table WHERE condition = TRUE";
$result = oci_execute($query, OCI_DEFAULT);

echo '<select>';

while ($row = oci_fetch_array($result)) {
   echo '<option value='" . $row['value'] . '">' . $row['text'] . '</option>';
}
echo '</select>';

Hopefully you get the concept out of that, and you can fill in the right query/oracle functions to get it to work.

The steps are basically...

  • Write query
  • Execute query
  • Open the <select>
  • Loop through query results
  • Print an option for each value in the query result set
  • Close the <select>

Good luck,
- Walkere

Dukane commented: nice explanation +2
Walkere 19 Junior Poster in Training

I'm afraid that didn't work, anyone else?

If you didn't set up the smtp settings in your php.ini file, it won't work. Check the SMTP and smtp_port settings.

If you're determined not to use the mail function or need something more advanced, try phpMailer.

Good luck,
- Walkere

iamthwee commented: thanx 4 lookin +13
Walkere 19 Junior Poster in Training

If you want your websites to be handicap-accessible, do not use hover images.

I think that paints the problem with far too broad a brush. Why would you have to get rid of all hover images in order to be handicap accessible?

Example. A hover image could be used to change the background of a link, simply to show that it is "hovered." Same way you would change the color of a link to show your mouse is over it. Purely visual, doesn't effect the functionality of the site. No reason it'll impair use by someone that won't be able to see the hover image.

Example. If you use a css-hover menu, you can use an alternate style sheet to make all of the links displayed, rather than not displayed until moused over.

There may be some cases where using hover images might impair the use of your website by someone using a screen reader - but there are plenty of situations where you can accommodate handicap users by making accessibility modifications.

We didn't make the world flat for people with wheelchairs. We built ramps.

- Walkere

ndeniche commented: excellent +3
Walkere 19 Junior Poster in Training

... I'm not entirely sure why'd you write your own function when the built-in addslashes function works perfectly well.

Aye, I was wondering the same thing.

addslashes() is slightly different - it escapes a couple of extra characters (including '\' and NUL). However, these (especially \) need to be escaped anyway.

So, to fill in the original example...

$unedited = $_POST['content'];
$content = addslashes($unedited);

However, you might be looking to learn how to use preg_replace... so we'll go back to the original example.

You can use preg_replace() like Fungus did with str_replace - sending an array as the search and replacement parameters.

The problem with your example is that you're only presenting one thing for the replacement parameter - "\'".

In order to replace ' with \' and " with \" you need to do one of a few things - perform two preg_replaces (one for each replacement), use arrays within the preg_replace, or use a variable in the regex to print the quote based on what the search found. I'm not that good with regex, so I'm not sure if you can do that... but I think you can.

Anyhow, here's an example of how you could use arrays to perform the desired function with preg_replace.

$string = "\"You're not very wise,\" said the wise man.";

$string = preg_replace(array("/'/", '/"/'), array("\'", '\"'), $string);
echo $string;

That appears to escape both the single and double quotes just fine.

Good …

Venom Rush commented: For someone so new to the site you really helped out big time ;) +1