SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Syntax For str_replace

    Hi,

    I have added a line to my code which is designed to insert a word that starts with a lower case. However I cant get the right syntax to match the rest of the insert code I have. Can anyone advise how I should set this line out. My brain is fried and I just cant get it to work.


    Code:
    	$usertypelink = '".str_replace(' ', '-',strtolower($_POST['usertype']))."',

    The code is 4th line down.

    Code:
        if(isset($_POST['registerSubmit']) && $_POST['registerSubmit'] == 'true'){
    	$usertype = ($_POST['usertype']);  
    	$usertypelink = '".str_replace(' ', '-',strtolower($_POST['usertype']))."',
    		$activationcode = ($uniquecode);   
        $firstname = mysql_real_escape_string(trim($_POST['firstname']));
        $surname = mysql_real_escape_string(trim($_POST['surname']));
            $registerEmail = trim($_POST['email']);   
    		$logo = ('defaultimage.png');   
    		$logo1 = ('defaultimage.png'); 
    		$logo2 = ('defaultimage.png'); 
    		$logo3 = ('defaultimage.png'); 		
            $registerPassword = trim($_POST['password']);  
            $registerConfirmPassword  = trim($_POST['confirmPassword']);  
                      
        if(!isset($firstname) || empty($firstname)) {
            $errors['firstname'] = "Please enter your First Name.";
        }
    	
    	if(!isset($surname) || empty($surname)) {
            $errors['surname'] = "Please enter your Surname.";
        }

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,121
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    What are you trying to achieve, as your syntax is wrong...
    PHP Code:
    $usertypelink str_replace(' ''-',strtolower($_POST['usertype'])); 
    Or
    PHP Code:
    $usertypelink "'".str_replace(' ''-',strtolower($_POST['usertype']))."'"
    Or
    PHP Code:
    $usertypelink '"'.str_replace(' ''-',strtolower($_POST['usertype'])).'"'

  3. #3
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks matey,

    The first one sorted it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •