Page 1 of 1
works on appserv but not wamp?
Posted: Sat Jul 25, 2009 6:07 pm
by vin_akleh
why this code works on appserv but not on wamp V 2.0 ??!
Code: Select all
if (preg_match("/^[-]/",$type)
{
echo '<h3>Please Choose a TYPE.</h3>';
}
gives me a "parse error in ...."
is there something i need to do so that this will work on wamp

Re: works on appserv but not wamp?
Posted: Sat Jul 25, 2009 8:11 pm
by jackpf
You're missing a bracket.

Re: works on appserv but not wamp?
Posted: Sun Jul 26, 2009 9:13 am
by vin_akleh
jackpf wrote:You're missing a bracket.

WHERE???
Re: works on appserv but not wamp?
Posted: Sun Jul 26, 2009 10:08 am
by jackpf
Line 1.
Re: works on appserv but not wamp?
Posted: Tue Aug 04, 2009 1:58 pm
by vin_akleh
jackpf wrote:Line 1.
even after adding the ) is still dont work
it out puts it as if it is not a code it is a text:
example
Please enter your Phone number
"); } else { if(preg_match("/^\(\+[0-9]{3}\) [0-9]{3} [0-9]{6}$/" , $test)) { echo "
Valid Number
"; } else { echo "
Invaild phone number
"; die("Please enter your Phone number in the following form (+555) 555 555555"); } } } else { ?>
Phone:______________
Re: works on appserv but not wamp?
Posted: Tue Aug 04, 2009 2:00 pm
by jackpf
Can you not post your entire code?
Turn on error reporting as well. That should show you where the error is.
Re: works on appserv but not wamp?
Posted: Tue Aug 04, 2009 2:05 pm
by vin_akleh
jackpf wrote:Can you not post your entire code?
Turn on error reporting as well. That should show you where the error is.
look im sure its not an error (my university Web doctor gave it to me)because is works fine on appserv but not on wamp witch im more comfortable using
i think there is something i should add to wamp so that it will recognize the preg (library or something).
???!!
Re: works on appserv but not wamp?
Posted: Tue Aug 04, 2009 2:07 pm
by vin_akleh
any way here is the whole code
Code: Select all
<html>
<body>
<?
if($_REQUEST["hide"]==1)
{
$test=$_REQUEST["phone"];
if($test == "")
{
die("<p style='color:#2baa55;font-size:20pt'>Please enter your Phone number</p>");
}
else
{
if(preg_match("/^\(\+[0-9]{3}\) [0-9]{3} [0-9]{6}$/" , $test))
{
echo "<p style='color:#2baa55;font-size:20pt'>Valid Number</p>";
}
else
{
echo "<p style='color:red'>Invaild phone number</p>";
die("Please enter your Phone number in the following form (+555) 555 555555");
}
}
}
else
{
?>
<form method="post">
<input name="hide" type="hidden" value="1">
Phone:<input name="phone" type="text">
<input type="Submit" value="Send">
</form>
<?
}
?>
</body>
</html>
Re: works on appserv but not wamp?
Posted: Thu Aug 06, 2009 7:42 am
by jackpf
Do you have short tags enabled on your server, since you are using <? instead of <?php
Also, what's output to the browser? As in, right click, view source. Could you post that here?