Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit on the same page 1

Status
Not open for further replies.

kurie

Programmer
Jun 4, 2008
170
ZA
Good day all,

does anyone know what im doing wrong here, i have a page, and on that i would like to submit a button and check if the button has been submited, on the same page, i dont want to navigate to another page on submit. here is the code.

Regards

<?php
echo "here ".isset($_Get['Send']);
if (isset($_POST['Send']))
{
echo "Button Pressed";
//echo "<td colspan="3" align="left" bgcolor="#5286B5" class="style16"><em><strong>SigmaMobWirels</strong></em></td>
}
?>


<form>
<table width="100%" border="0" bgcolor="#FFFFFF">
<tr>
<td colspan="3" bgcolor="#FFFFFF"><img src="images/wirels_logo.gif" width="44" height="22" alt="wirels connect logo" /></td>
</tr>
<tr>
<td colspan="3" align="left" bgcolor="#5286B5" class="style16"><em><strong>SigmaMobWirels</strong></em></td>
</tr>
<tr>
<td colspan="3" bgcolor="#FFFFFF"><span class="style15"> <span class="style16"> <span class="style17"> <span class="style18">
<span class="style19">
<span class="style20"> <span class="style21">
<span class="style22"> <span class="style23"> <span class="style17"> <span class="style22"> <span class="style15"> <span class="style24">
<marquee>
<strong>Sigma Messaging</strong>
</marquee>
</span></span></span></span></span></span></span></span></span></span></span></span></span></td>
</tr>
<tr>
<td colspan="3" bgcolor="#CCDDEE" class="style6">
<a href="m.wirelsc.mobi" class="style17">Contacts</a></td>
</tr>
<tr>
<td width="136" bgcolor="f7f7e7">Send To</td>
<td width="71" bgcolor="f7f7e7">
<input id="txtSendTo" type="text" /></td>
<td rowspan="4" bgcolor="f7f7e7">&nbsp;</td>
</tr>
<tr>
<td bgcolor="f7f7e7">Contact List </td> <td bgcolor="f7f7e7">
<input id="Checkbox1" type="checkbox" /></td>
</tr>
<tr>
<td bgcolor="f7f7e7">Message</td>
<td bgcolor="f7f7e7">
<textarea id="txtArea" cols="20" name="S1" rows="2"></textarea></td>
</tr>
<tr>
<td bgcolor="f7f7e7">&nbsp;</td>
<td bgcolor="f7f7e7">
<input id="Send" type="submit" value="Send" action = "send.php" /></td>
</tr>

<tr>
<td height="24" colspan="3" align="left" bgcolor="#5286B5"><span class="style3">Copy
Rights . SWirels 2011</span></td>
</tr>
</table>
</form>
 
Hi

Short answer :
Give a [tt]name[/tt] attribute to the [tt]submit[/tt] button. If you want to use POST method, also add a [tt]method[/tt] attribute to the [tt]form[/tt] tag.

Long answer :
You are member since 3++ years. Please pay some attention on what you post. Is easier for us to help you if you post clean and readable code.
[ul]
[li]Post your code between [tt][ignore]
Code:
[/ignore][/tt] and [tt][ignore]
[/ignore][/tt] TGML tags.[/li]
[li]Post syntactically correct PHP. ( No $_Get. )[/li]
[li]Post syntactically correct HTML. ( [tt]action[/tt] attribute of the [tt]form[/tt] tag is mandatory. )[/li]
[li]Do not post unrelated HTML elements. ( No 13 [tt]span[/tt] tags, one inside other. )[/li]
[li]Do not post HTML used for formatting. ( No [tt]em[/tt], [tt]strong[/tt] when debugging a [tt]form[/tt]. )[/li]
[li]Additionally you could avoid bad habits. ( No [tt]table[/tt] for layout, use CSS instead of deprecated attributes. )[/li]
[/ul]


Feherke.
 
thanks so much, much appreciated.
 
This may not be the thread in which to engage in a discussion regarding habits but why
No table for layout, use CSS instead of deprecated attributes.
. What about for those nearly negligible instances where CSS is unavailable? Shouldn't a layout be rendered?

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Hi

Geates said:
What about for those nearly negligible instances where CSS is unavailable? Shouldn't a layout be rendered?
Yes, I would say it should not. If CSS is off, that probably has a reason.

Beside that, if you force regular content into a [tt]table[/tt], it will not be wrapped when necessary. For example in the above example part of the table will be rendered as this :

[tt][small]+---------+------------------------------+
| Message | ,--------------------------. |
| | | textarea_ | |
| | | | |
| | `--------------------------' |
+---------+------------------------------+[/small][/tt]

But on a narrow display it may end up as this :

[tt][small]+---------+-----------------+
| Message | ,-------------. |
| | | textarea_ | |
| | | | |
| | `-------------' |
+---------+-----------------+[/small][/tt]

While without the unnecessary [tt]table[/tt] it could be wrapped as this :

[tt][small]Message
,---------------------------.
| textarea_ |
| |
`---------------------------'[/small][/tt]

I would prefer the later.


Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top