Hello i'm trying to keep the state off my radio buttons so it shows which ones where clicked after the submit button is clicked im new to this so bare with me.
heres my code
<?php
foreach($_POST as $key => $value){
$clicked[$key] = $value;
}
var_dump($clicked);
$block1 = $_POST['q1']+$_POST['q2']+$_POST['q3']+$_POST['q4'];
echo $block1*100/16;
?>
this is the result of the vardump.
array(5) { ["q1"]=> string(1) "1" ["q2"]=> string(1) "2" ["q3"]=> string(1) "3" ["q4"]=> string(1) "2" ["signup"]=> string(6) "submit" } 50
How can i take the value that is outputted from the relevant radio button and retain it after submit.
Here's the form code.
<FORM METHOD="post" ACTION="" id="check">
<table width="830" height="auto" border="0" cellpadding="1" cellspacing="1" style="">
<!----- SECTION ----->
<tr>
<h2>Marketing</h2>
</tr>
<tr>
<td width="25" align="center" valign="top" style="color: #D54D12"> </td>
<td width="622" class="none"><p> </p></td>
<td width="17" align="center" valign="middle" class="borderbutton">1</td>
<td width="17" align="center" valign="middle" class="borderbutton">2</td>
<td width="17" align="center" valign="middle" class="borderbutton">3</td>
<td width="17" align="center" valign="middle" class="borderbutton">4</td>
<td width="92"></td>
</tr>
<tr>
<td colspan="6" align="center" valign="top" class="none" style="color: #D54D12"><hr /></td>
<td></td>
</tr>
<tr>
<td width="25" align="center" valign="top" class="borderbutton" style="color: #D54D12">1.</td>
<td width="622" class="borderbutton"><p>I know where I want my business to go and have a clear vision how to get there.</p></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q1" value="1" validate="required:true" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q1" value="2" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q1" value="3" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q1" value="4" /></td>
<td width="92"><label for="q1" class="error">* Required.</label></td>
</tr>
<tr>
<td width="25" align="center" valign="top" class="borderbutton" style="color: #D54D12">2.</td>
<td width="622" class="borderbutton">I have a written marketing plan that I follow to ensure I market my brand on a regular basis.</td>
<td width="17" align="center" valign="middle" class="borderbutton">
<input type="radio" name="q2" value="1" validate="required:true" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q2" value="2" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q2" value="3" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q2" value="4" /></td>
<td width="92"><label for="q2" class="error">* Required.</label></td>
</tr>
<tr>
<td width="25" align="center" valign="top" class="borderbutton" style="color: #D54D12">3.</td>
<td width="622" class="borderbutton">I understand the role my brand (value delivered by my products and services ) plays in achieving my business goals.</td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q3" value="1" validate="required:true" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q3" value="2" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q3" value="3" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q3" value="4" /></td>
<td width="92"><label for="q3" class="error">* Required.</label></td>
</tr>
<tr>
<td width="25" align="center" valign="top" class="borderbutton" style="color: #D54D12">4.</td>
<td width="622" height="22" class="borderbutton">Our current prices are a true reflection of the value my brand brings our clients.</td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q4" value="1" validate="required:true" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q4" value="2" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q4" value="3" /></td>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="radio" name="q4" value="4" />
<!----- SECTION END ----->
</table>
<table>
<td width="17" align="center" valign="middle" class="borderbutton"><input type="submit"
name="signup" value="submit"></td>
</table>
</FORM>
Php navigation
I have four buttons on a php page.If i click a button it will redirect to different php pages.How would i do that with php?
problem with query error
First Thanks to those who helped me on my previous posts, and the following code i'm using is not mine, i grabbed it from here http://www.phpfreaks.com/tutorial/basic-paginationNow onto the
how do I show what a user have selected from a checkbox?
From my code below, how would i show which check boxes have been checked and which radio buttons selected?Code:
Number Format
Hi All,
help with Get_
ok some how this is not working i am not sure what i am doing wrong here but what this does is when the user goes to Secret-Codes.php they get a menu and when they pick the phone they want to view it
Need to write a cookie with a url var
Not sure if its possible, but I need to write a cookie with a url.So this would write 2232 as the cookie for ID.http://www.example.com/redirect.php?ID=2232Ultimately, I'm working on a pixel tracking
Help: calling function
Hi,Is it possible to call a php function on page close?If yes, could you explain how and where to call?any example code will be appreciated.Thanks
System copy error in RUN ABAP REPORT PHASE
Hi,
Taylor Series Function
So I am working a a project for my intro C++ class, and I am having some trouble with a function for approximating exp(x) using a taylor series. The taylor series approximations for exp(x) is:
Onclick problem in Firefox
Hi, I am using a <label onclick="myfunction(this)"></label>. It doesn't seem to trigger in Firefox but works fine with ie. Does anyone know why?Thanks