Hi,

I am wondering if i am able to insert 2 entries from a form to mysql.
for example:

</tr>
		<tr>
			<td bgcolor="#eeeeff">
			Is it a shared devices?<br>
			<font color='#F62817'>** If yes, please indicate the shared device num. </font>
			</td>
			<td bgcolor="#eeeeff">
				<SELECT name="shared">
				<option value="No"SELECTED>No</option>
				<option value="Yes">Yes</option>
			<INPUT type = "TEXT" name = name = "shared_remark" value = "NIL">
			
		</tr>

this the code, there are 2 questions asked and i want to the user to key in shared num if they choose "yes" option.
this 2 entries name (shared and shared_remark) will be inserted into the same field name of mysql. Can this be done?

I am trying to do this but doesnt seem to work.

echo $shared  + $shared_remark ;

thanks

Recommended Answers

All 4 Replies

I am trying to do this but doesnt seem to work.

echo $shared  + $shared_remark ;

1) PHP uses the '.' for a concatenation operator, like this:

echo $shared . $shared_remark;

2)
I'm assuming you're trying to do that after the user submits the info? In which case, are you getting the data from the $_POST array first?

Example:

$shared = $_POST['shared'];
if($shared == "Yes") {
$shared_remark = $_POST['shared_remark'];
}

1) PHP uses the '.' for a concatenation operator, like this:

echo $shared . $shared_remark;

2)
I'm assuming you're trying to do that after the user submits the info? In which case, are you getting the data from the $_POST array first?

Example:

$shared = $_POST['shared'];
if($shared == "Yes") {
$shared_remark = $_POST['shared_remark'];
}

Yes that's what i am what i want - Thanks

Also, will php be able to do for example -
if user is to choose 'No', the text box will not appear and if 'Yes' is chosen, the text box will appear for the user to key in the remark.

Also, will php be able to do for example -
if user is to choose 'No', the text box will not appear and if 'Yes' is chosen, the text box will appear for the user to key in the remark.

No, PHP is strictly server-side. However, you can use PHP to echo the neccessary JavaScript or CSS. I'm not a JS/CSS expert, so you'll have to ask someone else how to do that.

No, PHP is strictly server-side. However, you can use PHP to echo the neccessary JavaScript or CSS. I'm not a JS/CSS expert, so you'll have to ask someone else how to do that.

No worries. Thanks for your help. =)

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.