works on appserv but not wamp?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vin_akleh
Forum Commoner
Posts: 53
Joined: Sat Feb 14, 2009 10:26 am

works on appserv but not wamp?

Post 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 :?:
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: works on appserv but not wamp?

Post by jackpf »

You're missing a bracket. 8)
vin_akleh
Forum Commoner
Posts: 53
Joined: Sat Feb 14, 2009 10:26 am

Re: works on appserv but not wamp?

Post by vin_akleh »

jackpf wrote:You're missing a bracket. 8)
WHERE???
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: works on appserv but not wamp?

Post by jackpf »

Line 1.
vin_akleh
Forum Commoner
Posts: 53
Joined: Sat Feb 14, 2009 10:26 am

Re: works on appserv but not wamp?

Post 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:______________
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: works on appserv but not wamp?

Post by jackpf »

Can you not post your entire code?

Turn on error reporting as well. That should show you where the error is.
vin_akleh
Forum Commoner
Posts: 53
Joined: Sat Feb 14, 2009 10:26 am

Re: works on appserv but not wamp?

Post 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).
???!!
vin_akleh
Forum Commoner
Posts: 53
Joined: Sat Feb 14, 2009 10:26 am

Re: works on appserv but not wamp?

Post 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>
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: works on appserv but not wamp?

Post 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?
Post Reply