Using solution of an equation [duplicate]

I want to solve something like f(x)=0 and then have the real solution be set as the value of another variable. I can't figure out how to do it. I tried something like this as an example, but it didn't work.

a = Solve[x + 1 == 0, x, Reals]


added: Why won't my InputField dynamically update?

InputField[ Dynamic[G = x /. Solve[ 2 == x*Cos[\[Theta]] -(P*x^2)/(6*C*D) (3 F + x) Sin[\[Theta]], x, Reals]]]


second add: here's the rest of my code.

    Manipulate[
DynamicModule[{P = 0, C = 1, D = 1, F = 0, θ = 0},
Deploy[Style[
Panel[Grid[Transpose[{{"P", "C", "D", "F", "θ", "G"},
{InputField[Dynamic[P]], InputField[Dynamic[C]],
InputField[Dynamic[D]], InputField[Dynamic[F]],
InputField[Dynamic[θ]],
InputField[
Dynamic[
G = x /.
Solve[2 ==
x*Cos[θ] - (P*x^2)/(
6*C*D) (3 F + x) Sin[θ], x, Reals][]]]}}],
Alignment -> Right], ImageMargins -> 10, DefaultOptions ->
{InputField -> {ContinuousAction -> True,
FieldSize -> {{5, 30}, {1, Infinity}}}}]]] Dynamic[Show[
{Graphics[{Opacity[0.5], Red,
Rectangle[{1, 0}, {2, 1}]},
PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True,
AxesOrigin -> {0, 0}],
ParametricPlot[{x*Cos[θ] - (P*x^2)/(
6*C*D) (3 F + x) Sin[θ],
x*Sin[θ] + (P*x^2)/(6*C*D) (3 F + x) Cos[θ] +
G*Sin[θ] + (P*G^2)/(6*C*D) (3 F + G) Cos[θ] -
2}, {x, 0, B}, Axes -> True]}]]]]


marked as duplicate by Jens, MarcoB, user9660, Yves Klett, ArtesJul 8 '16 at 8:13

a = x /. Solve[x + 1 == 0, x, Reals][]

The [] selects the first solution, and the x /. applies the solution to the expression x.
• I don't know which variables are symbolic and which are numerical, but the Solve is very slow. Also, don't use capital variables. I run: g = x /. Solve[ 2 == xCos[[Theta]] - (px^2)/(6*c*d) (3 f + x) Sin[[Theta]], x, Reals][] InputField[Dynamic[g]] and this displays a result. If I set values for p, c, d, f, and theta, it gives numerics correctly. – Alex Meiburg Jul 8 '16 at 2:24