is there anything that can replace a butoon in php which acts like a button? because we all know that buttons in php act independently, meaning once button a is clicked, the functions of button b will be disregarded already right? because i have several buttons in the page and a simple one functions different from another..now the only thing i thought of is a button, but like what ive said, i want to have an alternate for it..

thanks in advance ^_^

Recommended Answers

All 12 Replies

is there anything that can replace a butoon in php which acts like a button? because we all know that buttons in php act independently, meaning once button a is clicked, the functions of button b will be disregarded already right? because i have several buttons in the page and a simple one functions different from another..now the only thing i thought of is a button, but like what ive said, i want to have an alternate for it..

thanks in advance ^_^

Sorry, nothing is understood from your question, If you can explain little clear, Daniweb people will help you.

its ok to have buttons in php. just name them different names. Then use the following coding for each button..

<?php
if(isset($_POST['name of button'])) {
// mysql code or php code
} ?>

does this help

yeah, i already got how to make the button do the work, however, we all know that, buttons work independently, button A is clicked, it will perform its function button B is clicked, again it will do its function too. the problem is that, how can i make once button A is clicked, the functions of button B is still present.

yeah, i already got how to make the button do the work, however, we all know that, buttons work independently, button A is clicked, it will perform its function button B is clicked, again it will do its function too. the problem is that, how can i make once button A is clicked, the functions of button B is still present.

If you do a form submit to send it to a php handler, that's all there is.
If you use type = button or type = radio you can preset them before the submit then the A and B setting can be taken in.

Your description is really too vague for anyone to give you any good advice.
Just because you click A , B should not stop working when the form is returned.
Are you tryng have them interact somehow?

As it happens I'm using this to swap fields...

<form action="<?php $PHP_SELF;?>" method="post"><input type="submit" value="Create new text field" name="change_text" id="change_text"></form>
<?php 
if ($logged_in == 'true') {
if (isset($_POST['change_text'])){
if (!isset($_POST['submit1'])){?>

and then this...

if (isset($_POST['submit1'])){echo $text2, $headline2;}
 if ($_POST['headline']){ 
if ($_POST['text']){
include("admin/create_text.php");

Notice the initial if ! is set post - very easy very nice.
You could always try styling your 'submit' button with css?!

@ JRM

how can i set preset the radio button without having clicked the submit button?? is it possible?? thanks. ^^

how can i make once button A is clicked, the functions of button B is still present.

You could use two different forms.
And to preset a button. Use....

<input type="radio"  value="Pick Me" checked  />

Or what about check boxes. Here is a quote...

"Radio buttons are used when you want to let the visitor select one - and just one - option from a set of alternatives. If more options are to be allowed at the same time you should use
check boxes instead".

@ JRM

how can i set preset the radio button without having clicked the submit button?? is it possible?? thanks. ^^

yes, that is what they are for.
Also see checkbox.
good info on HTML is available on w3.

yes, that is what they are for.
Also see checkbox.
good info on HTML is available on w3.

We need to know more about the problem, don't you think?

ahmm..i think i will use option button, because the user can only choose one option among the others at a time. hence, my problem is that how could i get the value of the option button without pressing a submit button, i mean, once i clicked the option button, it will automatically perform its function. ^^

okei..here it goes sir, i think i will use the option button because the user is allowed to choose only one among others. now, the problem is that, how can i get the value of the selected option button without pressing any submit button? meaning, once the option button is selected, it will automatically perform its funciton.

$resultParam_pp = mysql_query("SELECT * FROM SPC_InfoParameter ") or die(mysql_error());	
while($row = mysql_fetch_assoc($resultParam_pp))
{		
	$lblParameter_pp = $row['ParameterName'];
	$lblParameterSeq_pp = $row['Parameter_seq'];	
	
	echo "<tr>";
	echo "<form action = 'http://10.237.102.158/SPC_Stations/Grinding/spc_grd_02.php' method = 'post'>";
	echo "<td align = left>";					
                echo "<input type = 'radio' name = 'paramSelect' value = '$lblParameterSeq_pp'><font face = Arial size = 2>" . $lblParameter_pp;
	echo "<input type = 'hidden' name = 'hidParSel' value = '$lblParameterSeq_pp'></font>";
	echo "</td></form>";
	echo "</tr>";	
}

the problem of this code is taht, all the option buttons are clickable..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.