Form that prompts user for META Keywords help.

Discussion in 'HTML & Website Design' started by MediaHustler, Jan 31, 2006.

  1. #1
    Video Keyword (sparate with ,): <input type="text" name="metakeywords" value="" size="40" maxlength="40"/><br>

    So I have this but when then user puts , for seperation when the keywords are plugged into the template it looks like this

    funny humor comedy media

    No , but large gaps. What's the deal?
     
    MediaHustler, Jan 31, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The script you use to process the form input must have a function to remove any commas.

    Post the script here if you need more help.
     
    mad4, Jan 31, 2006 IP
  3. MediaHustler

    MediaHustler Well-Known Member

    Messages:
    1,857
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    120
    #3
    <?php 
        $words = explode(",",$_POST['metakeywords'],7); 
        $uploadDir = '../videos/'; 
        $filename = $_FILES['image']['name']; 
        $filearray = explode(".",$filename); 
        $keys = array_keys($filearray); 
        $suffix = end($keys); 
        $uploadFile = $uploadDir . $filename; 
        $imagedir = getcwd(); 
        $filenamecheck = $uploadDir.$filename; 
        $newname = $_POST['description'].".".$filearray[$suffix]; 
                                                   
        if (!file_exists($filenamecheck)) { 
            move_uploaded_file($_FILES['image']['tmp_name'], $uploadFile); 	
            chmod ($imagedir."/".$filename, 0755); 
            rename ($imagedir."/".$filename,$imagedir."/".$newname);
            $htmlfile = $_POST['nameofthehtml'] .".php"; 
            $fp = fopen($htmlfile, "w"); 
         
            $string = "<html><head><META NAME='keywords' CONTENT='".$words[0]." ".$words[1]." ".$words[2]." ".$words[3]." ".$words[4]." ".$words[5]." ".$words[6]." ".$words[7]."'> 
    <META NAME='description' CONTENT='".$_POST['metadescription']."'>
    PHP:
     
    MediaHustler, Jan 31, 2006 IP
  4. MediaHustler

    MediaHustler Well-Known Member

    Messages:
    1,857
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    120
    #4
    You see this?
    $string = "<html><head><META NAME='keywords' CONTENT='".$words[0]." ".$words[1]." ".$words[2]." ".$words[3]." ".$words[4]." ".$words[5]." ".$words[6]." ".$words[7]."'>

    Could I put commmas here?

    ".$words[0]." ,".$words[1]."

    ------------^
     
    MediaHustler, Jan 31, 2006 IP
  5. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You could do that yes.

    Not sure what your script is doing though - the first line
    $words = explode(",",$_POST['metakeywords'],7); is splitting apart the text string metakeywords at each comma do you need to do this for your script or could you just use the raw string?
     
    mad4, Jan 31, 2006 IP