Jump to content
xisto Community
Bkag

Need Some Code, Dont Know Where To Get It

Recommended Posts

I think what bkag means is a form that does the same as the webhosting application form, you can see that by looking in the application forum. Basically it is a form like i have created but instead of creating an ouput like it does at the moment it should redirect the user to the forum and to a page where a new topic is being made. The php should automatically create the topic title as the track location and then the message body will be the rest of the information entered on the form. then all the user has to do is double check everything and click on the button to post the topic. Correct me if im wrong bkag!I havent foubd a way of doing this, i tries using post variables but it didnt work, there might be an addon that you can install to do it for you though.

Share this post


Link to post
Share on other sites

Shadow you understand completely that is exactely what i want, i havve also been looking for a way on google but i cant seem to find one but im sure there is a way to do it and somone on here knows i am sure

Share this post


Link to post
Share on other sites

I have realised how bad i am at php all i tryed to do was add a county line and it doesnt work!

Here is the code:

.Htm<HTML><HEAD><TITLE>RC Track Information Form</TITLE></HEAD><BODY><!-- This is very plain and boring but you can easilly change the layout and colours, if you need help im sure I can give it and so can many other people at Xisto :-) --><TR><TD><BR></td></tr><form action=submittrackdirectory.php method=POST> <!-- submit.php can be changed to a different name if you need to. --><table border=0 cellpadding=0 rows=35%> <!-- for alignment purposes--><TR><TD><BR></td></tr><TR><TD>Name of Track:</td><td> <input type=text size=70 name=trackname align=center></td><TR><TD><BR></td></tr><TR><TD><b><u> Track Address </u></b></TR></TD><TR><TD><BR></td></tr><TR><TD>Street Address (First line only):</td><td> <input type=text size=100 name=streetaddr></td></tr><TR><TD><BR></td></tr><TR><TD>Town:</td><TD> <input type=text size=40 name=town></td><tr><TR><TD><BR></td></tr><TR><TD>County:</td><td><input type=text size=40 name=county></td><tr><TR><TD><BR></td></tr><TR><TD>Country:</td><td><input type=text size=40 name=country></td></tr><TR><TD><BR></td></tr><TR><TD>Postal/ZIP Code:</td><TD><input type=text size=15 name=postal></td></tr><TR><TD><BR></td></tr><TR><TD><BR><B><U>Contact Details</b></u></td></tr><TR><TD><BR></td></tr><TR><TD>Track Email address:</td><td><input type=text size=40 name=email></td></tr><TR><TD><BR></td></tr><TR><TD>Track Website:</td><td><input type=text size=40 name=website></td></tr><TR><TD><BR></td></tr><TR><TD><B><U>Track Description</B></U></td></tr><TR><TD><BR></td></tr><TR><TD>Description:</td><TD><textarea rows=10 cols=60 name="description"></textarea></tr></table><BR><BR><p align=center><input type=submit value="Submit"></form></p>[.php]<?// this page proccesses the information from the information form and gives an output which the user will see.//first get and set variables from POST$streetaddr = stripslashes($_POST['streetaddr']);$trackname = stripslashes($_POST['trackname']);$town = stripslashes($_POST['town']);$county = stripslashes($_POST['county']);$country = stripslashes($_POST['country']);$postal = stripslashes($_POST['postal']);$preemail = stripslashes($_POST['email']);$email= str_replace('@', '@', $preemail);//stops spambots finding email address and spamming the address$website = $_POST['website'];$description = $_POST['description'];// got variables so do something with them. make an output for the user as a html document//but first check if there is a website for this trackif($website == NULL) {$web = "There is no official website for this track at the moment.";} else {$web="This track also has an official website located at:";}//Now we can tell the user if the website exsists before we try to give them a URL$html = "<HTML><HEAD><TITLE>RC Track Information For $trackname</TITLE></HEAD><BODY><!-- again colours and layout can be easilly changed! --><BR><p align=center><h4><U>$town, $county, $trackname</h4></u></p><BR><B><U>Track location details</B></U><BR><p align=left>This track is located at $streetaddr in $town, $county, $country, $postal.<BR><BR><B><U>Track contact details</B></U><BR><BR>The track email address for primary contact is: $email<BR><BR>$web <a href=$website target=new_window>$website</a><BR><BR><B><U>Track description</B></U><BR><BR><HR><PRE>$description</PRE><HR></p></body></HTML>";echo $html;?>

But it seems as though it doesnt understand the new field and gets it confused with the town field/variable.

What have i done wrong?

Share this post


Link to post
Share on other sites

Strange i ran the code you had, both the html and php and it worked fine, are you sure you didnt accidentally put the COUNTY value into the COUNTRY box and thats what made it look weird? Thats what i done the first time.

 

after running it i noticed one problem with the website address, unless it was something like "http://site.com" the link made would act like a directory. So if someone put the website as "https://www.website.com/; the link created would be "http://forums.xisto.com/no_longer_exists/; and obviously that wouldnt work so ive added a little bit of code to look for "http://forums.xisto.com/; and insert it if its not already there.

 

try this code it should work, it did for me

 

[b]PHP[/b]<?// this page proccesses the information from the information form and gives an output which the user will see.//first get and set variables from POST$streetaddr = stripslashes($_POST['streetaddr']);$trackname = stripslashes($_POST['trackname']);$town = stripslashes($_POST['town']);$county = stripslashes($_POST['county']);$country = stripslashes($_POST['country']);$postal = stripslashes($_POST['postal']);$preemail = stripslashes($_POST['email']);$email= str_replace('@', '@', $preemail);//stops spambots finding email address and spamming the address$website = $_POST['website'];$description = $_POST['description'];// got variables so do something with them. make an output for the user as a html document//but first check if there is a website for this trackif($website == NULL || $website == "http://") {$web = "There is no official website for this track at the moment.";} else {$web="This track also has an official website located at:";}//Now we can tell the user if the website exsists before we try to give them a URL///////////////////////////////////////////////////////////////////////////////////////////////////////////																									  /////got to check for propper URL or it could find an invalid page or link back into our own directories!///$http = strpos($website, "http://");if($http == NULL) {   //dodgy wedsite URL, We gotta fix it.  $website = "http://$website";};//now the url is good so we can carry on															  /////																									////////////////////////////////////////////////////////////////////////////////////////////////////////////$html = "<HTML><HEAD><TITLE>RC Track Information For $trackname</TITLE></HEAD><BODY><!-- again colours and layout can be easilly changed! --><BR><p align=center><h4><U>$town, $county, $trackname</h4></u></p><BR><B><U>Track location details</B></U><BR><p align=left>This track is located at $streetaddr in $town, $county, $country, $postal.<BR><BR><B><U>Track contact details</B></U><BR><BR>The track email address for primary contact is: $email<BR><BR>$web <a href=$website target=new_window>$website</a><BR><BR><B><U>Track description</B></U><BR><BR><HR><PRE>$description</PRE><HR></p></body></HTML>";echo $html;?>[b]HTML[/b]<HTML><HEAD><TITLE>RC Track Information Form</TITLE></HEAD><BODY><!-- This is very plain and boring but you can easilly change the layout and colours, if you need help im sure I can give it and so can many other people at Xisto :-) --><TR><TD><BR></td></tr><form action=submittrackdirectory.php method=POST> <!-- submit.php can be changed to a different name if you need to. --><table border=0 cellpadding=0 rows=35%> <!-- for alignment purposes--><TR><TD><BR></td></tr><TR><TD>Name of Track:</td><td> <input type=text size=70 name=trackname align=center></td><TR><TD><BR></td></tr><TR><TD><b><u> Track Address </u></b></TR></TD><TR><TD><BR></td></tr><TR><TD>Street Address (First line only):</td><td> <input type=text size=100 name=streetaddr></td></tr><TR><TD><BR></td></tr><TR><TD>Town:</td><TD> <input type=text size=40 name=town></td><tr><TR><TD><BR></td></tr><TR><TD>County:</td><td><input type=text size=40 name=county></td><tr><TR><TD><BR></td></tr><TR><TD>Country:</td><td><input type=text size=40 name=country></td></tr><TR><TD><BR></td></tr><TR><TD>Postal/ZIP Code:</td><TD><input type=text size=15 name=postal></td></tr><TR><TD><BR></td></tr><TR><TD><BR><B><U>Contact Details</b></u></td></tr><TR><TD><BR></td></tr><TR><TD>Track Email address:</td><td><input type=text size=40 name=email></td></tr><TR><TD><BR></td></tr><TR><TD>Track Website:</td><td><input type=text size=40 name=website value="http://"></td></tr><TR><TD><BR></td></tr><TR><TD><B><U>Track Description</B></U></td></tr><TR><TD><BR></td></tr><TR><TD>Description:</td><TD><textarea rows=10 cols=60 name="description"></textarea></tr></table><BR><BR><p align=center><input type=submit value="Submit"></form></p>

The php and HTML you added seems fine to me!

Share this post


Link to post
Share on other sites

Glad to hear it! the only problem is this error message i just got:

phpBB : Critical Error
Could not connect to the database


unless youve put a wrong link in or something, seems strange to me. Maybe swl is experienceing troubles ill try again later. You might find an addon for your forum but i wouldnt know how to find it, sorry!

Glad to hear it was working though, ill check again abit later to see if its just a server problem!

Share this post


Link to post
Share on other sites

Ahh just saw it, it looks really good, i like the skin on it. Looks professional <_<Hope it helps you out in the future :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.