1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Submit page from skelenton

Discussion in 'PHP' started by paul_so40, Mar 15, 2009.

  1. #1
    Hi all,

    i need a script for a form.

    The form has 3 texboxes ( for example )

    When peeps click submit it creates a page from a skelenton page ( page template ) in a sub dir with the content of the 3 texboxes.

    Ive tried to keep it simple, dose anyone know a script that dose this ?

    Chears

    - Paul
     
    paul_so40, Mar 15, 2009 IP
  2. yoes_san

    yoes_san Peon

    Messages:
    443
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    didnt have a script but you can make do this by make script that:
    1. Read POST information
    2. Write POST contents to specific directory

    assume you use php, try searching google for "php read post" and "php write text file"
     
    yoes_san, Mar 15, 2009 IP
  3. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, but dose anyone know of a 3rd party existing script that dose this?
     
    paul_so40, Mar 15, 2009 IP
  4. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Seems hard to imagine; it's at once kind of specialised, and extremely simple to do (15 or 20 minutes). I think you're better off just hiring someone from the forum (not me; I don't like small projects).
     
    SmallPotatoes, Mar 15, 2009 IP
  5. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That was the original plan, but only just registerd and i cant wait f14 days to get this done
     
    paul_so40, Mar 15, 2009 IP
  6. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #6
    Celaring it a little,
    SmallPot... said 15 or 20 minutes not actually days. I would suggest you hire him or send him PM regarding this issue.
     
    Vooler, Mar 15, 2009 IP
  7. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    i never said days . . . digitl point has a block for you posting paid requests with an account thats not 14 days old . .. so i would have to waut 14 days to make the post
     
    paul_so40, Mar 15, 2009 IP
  8. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #8
    Sorry if I misunderstood :)

    I actaully assumed this from your phrase:
     
    Vooler, Mar 15, 2009 IP
  9. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #9
    The rules say you can't post to the BST section till after 14 days. I bet if you posted this again with the magic phrase - will pay, you will find someone to help you.
     
    shallowink, Mar 15, 2009 IP
  10. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Probly, but by the fact that i am looking for a free script is because i dont realy want to spend money on getting this.

    However i was going to post to see how much someone would exspect to be paid to make this.
     
    paul_so40, Mar 16, 2009 IP
  11. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #11
    Odds are you will have to pay someone. Its pretty specific and not very general. If that made sense. Cost should be minor. 5-15, just depending on how much detail you want. It isn't difficult to do, just not something that would be made into a free script. Maybe one of the code snippet sites would have something?
    I might write something up to do this but odds are it would be days before I did since I have work to do. Actually, I take that back. Your request differs from what I was looking at writing ( I want folders created with files pre populated per user but no content added)
     
    shallowink, Mar 16, 2009 IP
  12. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #12
    Sorry to be late, I suggested otherwise because I hadn't spare time last day. Here you go. This is simple example. Work on it little to make it more secure by creating sort of login etc.

    ASSUMED 3 FILES file1.html file2.html file3.html in templates folder containing word {REPLACE_DATA} to be relaced with input. Script will replace word {REPLACE_DATA} with input and write down file1, 2, and 3 html files in folder "output". Folder test must be chmod 777 s othat it has writing permissions.

    <?
    	if(empty($_POST)) {
    		?>
    		<form method="post">
    		    Text 1 <input type="text" name="input1"><br>
    		    Text 2 <input type="text" name="input2"><br>
    		    Text 3 <input type="text" name="input3"><br>
    		    <input type="submit" value="Save">
    		</form>
    		<?
    		die();
    	}
    
    	for($i=1; $i<=3; $i++) {
    		$data = file_get_contents("templates/file$i.html");
    		if(get_magic_quotes_gpc())
    			$data = stripslashes($data);
    		$data = str_replace("{REPLACE_DATA}",@$_POST["input$i"],$data);
    		
    		write_file("output/file$i.html",$data);
    	}
    	
    	#will write down output1.html output2.html output3.html
    
    
    
    
    	function write_file($filename,$data) {
    		$f = fopen($filename,"w");
    		fwrite($f,$data);
    		fclose($f);
    	}
    ?>
    Code (markup):


    Sample of inut html files, e.g. file1.html

    <html>
    <head>
    <title>Some title</title>
    </head>
    <body>
          <b> {REPLACE_DATA} </b>
    </body>
    </html>
    HTML:

    Attached is the sample project.


    I hope it helps.
     

    Attached Files:

    Vooler, Mar 16, 2009 IP
    shallowink likes this.
  13. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #13
    looks good to me Vooler. thanks. +rep
     
    shallowink, Mar 16, 2009 IP
  14. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Hi voolor and thanks for the example code. I am havng a problom with it working.

    i chmod all files and folders to 777 and still dosent work.

    i have uploaded it to http:// www. beta.united-gamerz.com /index.php ( wihtout spaces )

    what shal i do ?

    P.S i am using the attachment
     
    paul_so40, Mar 16, 2009 IP
  15. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    i could be wrong, i have been wrong in the past, but should index.php start of with <?php and not <? or dose it not matter

    code you gave me and being used


    <?
    	if(empty($_POST)) {
    		?>
    		<form method="post">
    		    Text 1 <input type="text" name="input1"><br>
    		    Text 2 <input type="text" name="input2"><br>
    		    Text 3 <input type="text" name="input3"><br>
    		    <input type="submit" value="Save">
    		</form>
    		<?
    		die();
    	}
    
    	for($i=1; $i<=3; $i++) {
    		$data = file_get_contents("templates/file$i.html");
    		if(get_magic_quotes_gpc())
    			$data = stripslashes($data);
    		$data = str_replace("{REPLACE_DATA}",@$_POST["input$i"],$data);
    		
    		write_file("output/file$i.html",$data);
    	}
    	
    	#will write down output1.html output2.html output3.html
    
    
    
    
    	function write_file($filename,$data) {
    		$f = fopen($filename,"w");
    		fwrite($f,$data);
    		fclose($f);
    	}
    ?>
    PHP:
     
    paul_so40, Mar 16, 2009 IP
  16. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #16
    <? is short tags and yes, if your webhost isn't configured it could result in the scripts not working. just switch it to <?php
     
    shallowink, Mar 16, 2009 IP
  17. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    nope still dosent work, dose it work for any1 else?

    http://www.beta.united-gamerz.com/index.php
     
    paul_so40, Mar 16, 2009 IP
  18. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #18
    yes it works for me as far as creating the files etc.

    
    <?php
        if(empty($_POST)) {
            ?>
            <form method="post">
                Text 1 <input type="text" name="input1"><br>
                Text 2 <input type="text" name="input2"><br>
                Text 3 <input type="text" name="input3"><br>
                <input type="submit" value="Save">
            </form>
    <?php
            die();
        }
    
        for($i=1; $i<=3; $i++) {
            $data = file_get_contents("templates/file$i.html");
            if(get_magic_quotes_gpc())
                $data = stripslashes($data);
            $data = str_replace("{REPLACE_DATA}",@$_POST["input$i"],$data);
           
            write_file("output/file$i.html",$data);
        }
       
        #will write down output1.html output2.html output3.html
    
    
    
    
        function write_file($filename,$data) {
            $f = fopen($filename,"w");
            fwrite($f,$data);
            fclose($f);
        }
    ?>
    
    PHP:
     
    shallowink, Mar 16, 2009 IP
  19. paul_so40

    paul_so40 Peon

    Messages:
    119
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    YES - it works now, because i had visited the page b4 ie8 made a catche of the file, so it looked like it wasent changing.

    Juts one last thing, dose any one know how to make the scrip make only one page, and the name and title of the page created, and so it dosent overite the same file ?

    thanx
     
    paul_so40, Mar 16, 2009 IP
  20. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #20
    Could not follow what do you mean by making one file ?
     
    Vooler, Mar 16, 2009 IP