PDA

View Full Version : I Writed A Script But I Have 1 Problem!


sleepingdanny
10-24-2002, 01:09 PM
This is my script >>>

The first file:

<form method="POST" action="2.php">
<input type="text" name="a">
<input type="submit" value="Search">
</form>

The second file:

<?
print "<img src=http://images.neopets.com/pets/happy/$a_blue_baby.gif>";
?>

But when i write something in the "a" input it prints the image like this >>>
http://images.neopets.com/pets/happy/(Now it writes only what i writed in the "a" input and doesn't write "_blue_baby"...

Why is that ???

Grizzly
10-24-2002, 03:08 PM
change the second file to say:


print "<img src=http://images.neopets.com/pets/happy/".$a."_blue_baby.gif>";

Halide
10-24-2002, 07:48 PM
or put { and } around the variable, because the _ (and the other alphanumeric or _ chars) is considered a continuation of $a

sleepingdanny
10-25-2002, 08:33 AM
Thank you :-)

sleepingdanny
10-25-2002, 09:15 AM
Is there a way to make this option for the script...
If someone writes in capital letters >>> it will turn the word to small letter ??

Grizzly
10-25-2002, 10:14 AM
strtolower("Upper Cased Phrase") (http://www.php.net/manual/en/function.strtolower.php)

sleepingdanny
10-27-2002, 07:31 AM
But where do i add this options in my script ??

Uranium-235
10-28-2002, 10:43 PM
print "<img src=http://images.neopets.com/pets/happy/" . strtolower($a) . "_blue_baby.gif>";

sleepingdanny
10-29-2002, 12:38 PM
Thanks :-)

Uranium-235
10-30-2002, 10:26 PM
I see another problem, which is this thread title

<?php

$title = str_replace("Writed", "Wrote", $title);

?>