Ideals contained in the exactly same prime ideals

Let $A$ be a commutative ring with unity, $S\subset A$ arbitrary and $g\in A$. I'm trying to prove the following result:

If for every prime ideal $\mathfrak{p}$ we have $$\mathfrak{p}\supset (S)\implies \mathfrak{p}\supset (S, g)$$

then $g\in(S)$, where $(C):=\left\{\sum_{i=1}^na_ic_i\mid a_i\in A, c_i\in C\right\}$.

I think this can be done by contradiction. Suppose $g\notin (S)$, then $(S)\subsetneq(S, g)$. By the property above, $\text{rad}((S, g))=\cap_{p\supset(S,g)}p=\cap_{p\supset(S)}p=\text{rad}((S))$. I'm trying to argue that the proper inclusion $(S)\subsetneq(S, g)$ implies $\text{rad}((S))\subsetneq\text{rad}((S, g))$, which gives us a contradiction. But I don't know how to formalize this step, in fact I'm not even sure it is true.

How do I resolve this?

[EDIT: the original problem I was given in class is this: Let $A$ be a ring, $g\in A$ and $S\subset A$. Let $U_g$ be the associated principal open subset of $\text{Spec}(A)$. Show that $U_g\subset \cup_{h\in S}U_h \iff g\in(S)$. Conclude that $\text{Spec}(A)$ is quasi-compact.]

• We have $(x^2,y^2)\subsetneq(x^2,y^2,y)$, both ideals have the same radical, and $y\notin(x^2,y^2)$. That is, for $S=\{x^2,y^2\}$ and $g=y$ your claim is wrong. – user26857 Apr 9 '17 at 18:11
• @user26857 I've edited the question writing the original problem. Did I misinterpreted it or is the original problem just wrong? – rmdmc89 Apr 9 '17 at 18:37
• In my opinion you should have $g^n\in(S)$ for some $n\ge 1$. – user26857 Apr 9 '17 at 18:48

I think the statement is false. Take $A=k[[x]]$, and $S=x^2$, $g=x$. There is an unique prime ideal containing $S$, which is $(x)$. However, $x$ is not in the ideal generated by $S$.
• As user26857 mentioned, you should get $U_g \subset \cup_{h \in S} U_h \iff \exists n \in \mathbb{N}$ such that $g^n \in S$. I think you can use locallization to prove it. – userabc Apr 9 '17 at 19:17