View Full Version : What the hell is wrong with this?
Link14716
11-25-2002, 08:28 PM
if ($submit=="true") {
if (!title) {
show_nopermission();
}
if (!code) {
show_nopermission();
}
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pa getext,ipaddress,site,siteid) VALUES (NULL,'$gid','".addslashes(htmlspecialchars($title))."','".addslashes($bbuserinfo[username])."','$bbuserinfo[userid]','".time()."','".addslashes($code)."','$ipaddress','2','$siteid')");
header ("Location: content.php?action=code&do=display&gid=$gid");
exit;
}
It stops before it even hits the redirect. No errors, nothing. Just a blank page. What is wrong with it?
Xenon
11-25-2002, 08:32 PM
i'd say your variable $submit would be not "true"
where do you get this var?
also title and code should be introduced with an $ ;)
Link14716
11-25-2002, 08:38 PM
$siteheader
$sitemiddle1
Add Codes ($gamename)
$sitemiddle2
<form $enctype action="addcontent.php?action=code&subaction=main" name="vbform" method="post">
<input type="hidden" name="submit" value="true">
<input type="hidden" name="gid" value="$gid">
<center>Code Title:</center><br>
<input type="text" class="bginput" name="title" value="$title" size="40" maxlength="85" tabindex="1"><br><br>
<center>Code Content:</center><br>
<textarea name="code" rows="7" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>
<br><br> <input type="submit" class="bginput" name="submit" value="Submit Code" accesskey="s" tabindex="3">
</form>
$sitefooter
I am using that template to submit the variables in a form. Everything appears correctly.
And I missed the $ and didn't notice it due to lack of parse error. ;)
EDIT:
if (!$submit) {
eval("dooutput(\"".gettemplate("site_v$v" . "_addcodes_main")."\");");
}
That is when submit s not true. ;)
Xenon
11-25-2002, 08:40 PM
ah i see your fault:
$siteheader
$sitemiddle1
Add Codes ($gamename)
$sitemiddle2
<form $enctype action="addcontent.php?action=code&subaction=main" name="vbform" method="post">
<input type="hidden" name="submit" value="true">
<input type="hidden" name="gid" value="$gid">
<center>Code Title:</center><br>
<input type="text" class="bginput" name="title" value="$title" size="40" maxlength="85" tabindex="1"><br><br>
<center>Code Content:</center><br>
<textarea name="code" rows="7" cols="$textareacols" wrap="virtual" tabindex="2">$message</textarea>
<br><br><input type="submit" class="bginput" name="submit" value="Submit Code" accesskey="s" tabindex="3">
</form>
$sitefooter
as you can see you have two variablenames called submit, and the last one counts i think, so your true will always be overwritten ;)
Link14716
11-25-2002, 08:42 PM
And this is exactly why I hate HTML ;)
Link14716
11-25-2002, 08:43 PM
Changed that variable to send, modified the file, BAM! It works. Thank you, Xenon! :D
Xenon
11-25-2002, 08:44 PM
:)
you're welcome
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.