PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Fri Sep 01, 2006 8:43 pm
ok trying to pass a url for form submit.. but nothing happening..
Code: Select all
<script language="javascript">
function submitform(url)
{
document.form.submit(url);
}
</script>
Code: Select all
<form action="#" method="POST">
<input type="image" src="images/unpublish.png" height="18" name="publish" onclick="javascript:submitform(<?php echo $globals->replace($_REQUEST['a'],"active",$_SERVER['REQUEST_URI']);?>)" value="0"></input>
</form>
Whats wrong ....
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Sep 01, 2006 8:55 pm
Well, document.form.submit() isn't correct. And the onclick doesn't need "javascript:" in it.
s.dot
Tranquility In Moderation
Posts: 5001 Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana
Post
by s.dot » Sat Sep 02, 2006 2:39 am
ole wrote: yeah its document.form[0].submit()
document.form
s [0].submit();
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
jmut
Forum Regular
Posts: 945 Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:
Post
by jmut » Sat Sep 02, 2006 4:28 am
feyd wrote: Well, document.form.submit() isn't correct. And the onclick doesn't need "javascript:" in it.
yes it does need it.
unless you have meta tag saying you use javascript.
Ollie Saunders
DevNet Master
Posts: 3179 Joined: Tue May 24, 2005 6:01 pm
Location: UK
Post
by Ollie Saunders » Sat Sep 02, 2006 7:15 am
scottayy wrote: ole wrote: yeah its document.form[0].submit()
document.form
s [0].submit();
Right.
yes it does need it.
unless you have meta tag saying you use javascript.
I've never used it. What would that meta tag look like?
jmut
Forum Regular
Posts: 945 Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:
Post
by jmut » Sat Sep 02, 2006 9:14 am
well, I guess it will never hurt really because I suppose browser by default assume javascript but still...
this on top never hurts
Code: Select all
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Sat Sep 02, 2006 12:32 pm
Thanks guys..
wow lots of info .. nice..
ol4pr0
Forum Regular
Posts: 926 Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador
Post
by ol4pr0 » Sat Sep 02, 2006 12:37 pm
However not working
changed the document.form[0].submit(url)
and also tried taking off the javascript part from the :submit(the.php.echo)
But no luck..
its submitting but its not passing trough the url ... am i missing somethign else here.
the other problem is that the post variables arent actually changing.. just the button..
the form code looks like this.
Code: Select all
<th scope="col" width="10px;"><? echo $row->login; ?></th>
<th scope="col" width="20px;"><? echo $row->level; ?></th>
<th scope="col" width="50px;"><? echo $row->active; ?></th>
<th scope="col" width="10px;"><? echo $row->lastlogin; ?></th>
<th scope="col" width="10px;">
<input type="image" src="images/edit.png" width="22" height="22" border="0" name="edit" onclick="javascript:submitform(<?php echo $globals->replace($_REQUEST['a'],"active",$_SERVER['REQUEST_URI']);?>)"></input>
<input type="hidden" value="<? echo $row->id; ?>" name="u"></input>
</th>
<th scope="col" width="10px;">
<?
if ($row->active == true) {?>
<input type="image" src="images/unpublish.png" height="18" name="publish" onclick="submitform(<?php echo $globals->replace($_REQUEST['a'],"active",$_SERVER['REQUEST_URI']);?>)"></input>
<input type="hidden" name="active" value="0"></input>
<input type="hidden" value="<? echo $row->id; ?>" name="u"></input>
<?} else {?>
<input type="image" src="images/publish.png" height="18" name="publish" onclick="submitform('<?php echo $globals->replace($_REQUEST['a'],"delete",$_SERVER['REQUEST_URI']);?>')"></input>
<input type="hidden" name="active" value="1"></input>
<input type="hidden" value="<? echo $row->id; ?>" name="u"></input>
Last edited by
ol4pr0 on Sat Sep 02, 2006 12:47 pm, edited 1 time in total.
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Sat Sep 02, 2006 12:41 pm