vForums Support > Programming & Coding :: Programming Discussion :: > need some help?

need some help? - Posted By Nick (nickb) on 11th Jan 10 at 7:21am
I need some help with a few things, firstly I need a submition form like The Web Tower.com has, and second I need a code that has the "waiting for approval" and shows the submitted form for others to see. I'm trying to make an affiliate type of site. like The web tower is, but mine will just be a directory, which is. http://thedirctory.2x.nu

I also need some help with API, but maybe i should post in the API board? {Tongue Out}

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 7:28am
Yes to posting in the API board for API support. And do you want the form to email you or what? {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 7:31am
Yeah to email me, and then send them to another page saying that it's going in for approval, and thanks, Also my affiliate banner/code on the same page and what ever else. {Tongue Out} Then I can add their Affiliate Banner into the Directory. when I get it/approve it.

and ok, also thanks!:)

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 7:33am
Ok, well I'll just make it redirect to a set page for you! {Smile}

What things do you want them to provide when submitting? {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 7:39am
Ok and:

User Name:
E-Mail:
Site URL:
Site Banner:
Site Category: e.g. Anime, Computing, etc

{Smile}

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 7:54am
<?
if($_SERVER['REQUEST_METHOD'] == 'POST'){
     if(!isset($_POST['username']) || $_POST['username'] == '')
          $error[] = 'Username is required';
     if(!isset($_POST['email']) || $_POST['email'] == '')
          $error[] = 'Email is required';
     if(!isset($_POST['site']) || $_POST['site'] == '')
          $error[] = 'Site URL is required';
     if(!isset($_POST['banner']) || $_POST['banner'] == '')
          $error[] = 'Banner URL is required';
     if(!isset($_POST['category']) || $_POST['category'] == '')
          $error[] = 'Site Category is required';
     if(!isset($error)){
          mail("Email Address", "New Site Submission", "Username: " . $_POST['username'] . "\nEmail: " . $_POST['email'] . "\nSite: " . $_POST['site'] . "\nBanner: " . $_POST['banner'] . "\nCategory: " . $_POST['category'], "From: " . $_POST['username'] . " <" . $_POST['email'] . ">");
          header("location: ./confirm.html");
     }else
          echo "-" . implode("<br />-", $error);
}
?>
<form action = 'dm_email.php' method = 'post'>
     Username: <input name = 'username' /><br />
     Email Address: <input name = 'email' /><br />
     Site URL: <input name = 'site' /><br />
     Banner URL: <input name = 'banner' /><br />
     Site Category: <input name = 'category' /><br />
     <input type = 'submit' value = 'submit' />
</form>


That's the code that you need. Simply modify the coloured bits.
Red = Email Address to send them to.
Blue = Confirmation page (saying it's been submitted etc...)
Green = Name of the file that you save that code as. When I was testing I saved the file as 'dm_email.php' you might save it as 'submit.php' {Smile}

Questions, post them. {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:02am
Thanks I have uploaded it, Now how do I add the form?

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 8:03am
The form is part of that page! {Wink}
You browse to that page, and the form will appear, and then people can fill it in! {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:15am
Oh I see. Is there anyway it can be displayed on the main home page?

Because I got this: http://thedirectory.2x.nu/submit.php But I want it on the home page. {Tongue Out}

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 8:22am
Put the code on the home page {Wink}

Just copy & Paste the code, and remember to change the different parts! {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:25am
Ok, so the whole code? and nothing detaches from it?

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 8:27am
Nope. {Smile}
Just copy & paste it where you want it. {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:31am
Ok I did, and this shows up above it:

"); header("location: ./confirm.html"); }else echo "-" . implode("
-", $error); } ?>

http://thedirectory.2x.nu/

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 8:34am
That doesn't show up for me....{Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:36am
{Tongue Out} http://i185.photobucket.com/albums/x20/magedesigns/misc/directory.jpg

It submits just fine though. as you can see in the form. xD

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 5:52pm
ok put the code:

<?
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if(!isset($_POST['username']) || $_POST['username'] == '')
$error[] = 'Username is required';
if(!isset($_POST['email']) || $_POST['email'] == '')
$error[] = 'Email is required';
if(!isset($_POST['site']) || $_POST['site'] == '')
$error[] = 'Site URL is required';
if(!isset($_POST['banner']) || $_POST['banner'] == '')
$error[] = 'Banner URL is required';
if(!isset($_POST['category']) || $_POST['category'] == '')
$error[] = 'Site Category is required';
if(!isset($error)){
mail("Email Address", "New Site Submission", "Username: " . $_POST['username'] . "\nEmail: " . $_POST['email'] . "\nSite: " . $_POST['site'] . "\nBanner: " . $_POST['banner'] . "\nCategory: " . $_POST['category'], "From: " . $_POST['username'] . " <" . $_POST['email'] . ">");
header("location: ./confirm.html");
}else
echo "-" . implode("<br />-", $error);
}else{
echo "Not submitted correctly";
}
?>


in a file called submit.php

then:

<form action = 'submit.php' method = 'post'>
Username: <input name = 'username' /><br />
Email Address: <input name = 'email' /><br />
Site URL: <input name = 'site' /><br />
Banner URL: <input name = 'banner' /><br />
Site Category: <input name = 'category' /><br />
<input type = 'submit' value = 'submit' />
</form>


Place that where you want the form {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:43pm
Thanks that worked. {Smile}

Now I need a little more help with the css. You see they greyish line running through the middle? well that's actually supposed to be at the top. but when ever I try to put it at the top, it wont.

Code:
 
  1. table {background: url('http://i185.photobucket.com/albums/x20/magedesigns/directory/wallpaper1.png') repeat bottom}
  2. table2 {background: url('http://i185.photobucket.com/albums/x20/magedesigns/directory/wallpaper2.png')repeat bottom}
 


The reason why it says bottom is because if I put top or middle it falls of the screen, and it's not supposed to do that. I am not sure how, or what to do with this. {Unsure}

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 8:46pm
Where are you using that?

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 8:52pm
This: <link rel="stylesheet" type="text/css" href="http://thedirectory.2x.nu/style.css">


It's on all pages of the site.

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 9:13pm
The background1 image is too tall, it's not just the small gradient... =/
Change the image. {Smile}

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 9:16pm
Ahh ok. I think I know what I did. xD I'll download the images, and crop them so that they are correct.

I'll be redesigning it anyways later. But for now, I'll be working with what I got.

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 9:18pm
{Smile}
Gooood.

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 9:37pm
Ok, it's not working correctly. I changed the image, but it's still not working properly. I have the tags correctly added in the index.html, The form is what's messing it up for some reason, because if you go to another page, it'll show just fine. Not sure what's going on. But I guess I'll have to start on the redesign soon.

edit: now I'm so confused with this now... On every page it's not working properly.

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 9:40pm
http://i185.photobucket.com/albums/x20/magedesigns/directory/wallpaper1.png

The image hasn't been changed! =/

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 9:46pm
Yeah it was changed:

table {background: url('http://i185.photobucket.com/albums/x20/magedesigns/directory/gradbar.png') no-repeat bottom}
table2 {background: url('http://i185.photobucket.com/albums/x20/magedesigns/directory/gradbar.png') no-repeat bottom}

If I type top, it's totally off the page, and if I type middle it's off the page, and if I type bottom it's at the bottom of the page.

Re: need some help? - Posted By Michael (wrighty) on 11th Jan 10 at 9:49pm
Why in the HTML have you given it a height of 400px? O.o

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 9:53pm
I don't even remember doing that. xD I have taken it out, but nothing has changed.

Re: need some help? - Posted By Nick (nickb) on 11th Jan 10 at 10:23pm
How do you get it all in div's instead of tables? I know Dwight did it, but I cannot remember how he did it. It'd be allot easier to work with that, then these tables.

Re: need some help? - Posted By Michael (wrighty) on 12th Jan 10 at 6:13am
It's best you take a look into CSS more in depth, I'm not going to be able to sit and explain the whole thing for you. But just start simple, and work up. {Smile}

Re: need some help? - Posted By Nick (nickb) on 12th Jan 10 at 8:06am
Yep, I got it working now! {Grin} The site is nearly complete. Try for your self! {Smile}

Re: need some help? - Posted By dog199200 (dog199200) on 12th Jan 10 at 8:08am
{Tongue Out} I showed him the lovely use of Include functions {Tongue Out}

Re: need some help? - Posted By Nick (nickb) on 12th Jan 10 at 8:09am
and I LOVE IT! ^_^ It's allot easier! {Grin}