PDA

View Full Version : Add more text fields in vBulletin



Siege1386
Sat 19th May '01, 1:02am
How do I customize my newthread.php to add in new text fields. Ex. in my case instead of message I need $tab, $explanation, and $key as well as username, forum id etc. I would also like to make a form that posted a thread on a different html document. I think I have already done that correctly.

Seperate html document:
<form METHOD="POST" NAME="postthread" action="http://www.guitar-rampage.f2s.com/Lessons/Contribute/upload/newthread.php?action=postthread">
<table width="100%">
<tr><td valign=top>
Your Name:
</td><td valign=top>
<input type=text name="username" value="" size="40">
</td>
</tr>

<tr><td valign=top>
<p> </p>
Subject:
</td><td valign=top>
<p> </p>
<input type=text name="subject" value="" size="40">
<p> </p>
</td>
</tr>



<tr><td valign=top>
Explanation 1:
<p><font color=blue>HTML OK in here. Type &lt;p&gt; to separate paragraphs.
</td><td valign=top>
<TEXTAREA NAME="explanation" value="" ROWS=10 COLS=82 wrap=physical>

</textarea>
</td></tr>
<tr>
<td valign=top>
Key:
</td><td valign=top>
<input type=text name="key" value="" size="20">
</td></tr>
<tr><td valign=top>
Tab:
<p><font color=blue>
Don't put explanation text under the tab!
</td><td valign=top>
<TEXTAREA NAME="tab" ROWS=15 COLS=82 wrap=physical>

E |-------------------------------|----------------------------------|
B |-------------------------------|----------------------------------|
G |-------------------------------|----------------------------------|
D |-------------------------------|----------------------------------|
A |-------------------------------|----------------------------------|
E |-------------------------------|----------------------------------|

E |-------------------------------|----------------------------------|
B |-------------------------------|----------------------------------|
G |-------------------------------|----------------------------------|
D |-------------------------------|----------------------------------|
A |-------------------------------|----------------------------------|
E |-------------------------------|----------------------------------|

</textarea>
</td></tr>
<tr><th colspan=2 align=left>

<p> </p>
Categorization: If you don't fill these out, no one can find your work.
<p>
</th>
</tr>
<tr><td valign=top>
Category:
</td><td valign=top>
<select name="forumid">
<option value="1">Playing
<option value="2">Purchasing
<option value="3">Recording
<option value="4">Other

</select>
</td></tr>


</td>
</tr>

</td></tr>
<tr><td valign=top>
<p> </p>
<table bgcolor=blue><tr><td>
<INPUT TYPE="HIDDEN" NAME="action" VALUE="postthread">
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Submit New Lesson">
<INPUT TYPE="RESET" NAME="Reset" VALUE="Clear Fields">
</td></tr></table>
</form>
</tr></td>
<tr><td valign=top>
<table bgcolor=red><tr><td valign=top>
<form>
<input type=button value=" Cancel " onclick="history.go(-1);">
</form>
-----------------------------------------------------------

Newthread.php

<?php

require("./global.php");

if (isset($action)==0 or $action=="") {
$action="newthread";
}

// ############################### start new thread ###############################
if ($action=="newthread") {
$forumid = verifyid("forum",$forumid);

$foruminfo=$DB_site->query_first("SELECT title,description,active,allowposting FROM forum WHERE forumid=$forumid");
$forumtitle=htmlspecialchars($foruminfo[title]);
if ($foruminfo[active]==0) {
echo standarderror($bbtitle,gettemplate("error_forumclosed",0));
exit;
}
if ($foruminfo[allowposting]==0) {
echo standarderror($bbtitle,gettemplate("error_forumnoreply",0));
exit;
}

eval("echo dovars(\"".gettemplate("newthread")."\");");

}

// ############################### start post thread ###############################
if ($action=="postthread") {

// check for subject and message
if (trim($subject)=="" or trim($tab)=="" or trim($key)=="" or trim($explanation)=="") {
echo standarderror($bbtitle,gettemplate("error_nosubject",0));
exit;
}



$forumid=verifyid("forum",$forumid);

//check valid name
if ($username=="" or trim($username)=="") {
echo standarderror($bbtitle,"Please enter your name in the 'Name' field.");
}

$foruminfo=$DB_site->query_first("SELECT active,allowposting,title FROM forum WHERE forumid=$forumid");
$forumtitle=$foruminfo[title];
if ($foruminfo[active]==0) {
echo standarderror($bbtitle,gettemplate("error_forumclosed",0));
exit;
}
if ($foruminfo[allowposting]==0) {
echo standarderror($bbtitle,gettemplate("error_forumnoreply",0));
exit;
}

//create new thread
$DB_site->query("INSERT INTO post (postid,threadid,title,username,email,dateline,exp lanation,tab,key) VALUES (NULL,$threadid,'','".addslashes($username)."','".addslashes($email)."','".time()."','".addslashes($explanation)."','".addslashes($tab)."','".addslashes($key)."')");
$threadid=$DB_site->insert_id();

// create first post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,email,dateline,exp lanation,tab,key) VALUES (NULL,$threadid,'','".addslashes($username)."','".addslashes($email)."','".time()."','".addslashes($explanation)."','".addslashes($tab)."','".addslashes($key)."')");

// update forum stuff
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost=".time()." WHERE forumid=$forumid");

// redirect
echo standardredirect($bbtitle,"Thank you for posting, $username. You will now be taken to your post.","showthread.php?threadid=".intval($threadid));
}

?>